tags:

views:

112

answers:

1

I am doing punch card reader programming..

Establish connection with BioAccess V2 Device...

socket successdully connected but data can't read...

so how to read data ?

Socket sock = new Socket(AddressFamily.InterNetwork, SocketType.Stream,ProtocolType.Tcp);  
var ipaddress = IPAddress.Parse("192.168.000.111");  
IPAddress add = new IPAddress(ipaddress.GetAddressBytes());    
EndPoint ep = new IPEndPoint(add, 5005);  
sock.Connect(ep);  
if(sock.connected)
{

}

now what i have to do in IF BLOCK to read data ?

+1  A: 

You need to use one of the Socket.Receive overloads to read data.

byte[] bytes = new byte[256];
try 
{
    int i = server.Receive(bytes);
}
Oded
can't read connection forcefully shutdown error comes.
DATT OZA
What is on the other end of the socket?
Oded