开发者

How To Read Data using Ip Address

开发者 https://www.devze.com 2022-12-24 03:49 出处:网络
I am doing punch card reader programming.. Establish connection with BioAccess V2 Device... socket successdully connected but data can\'t read...

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.Int开发者_如何学GoerNetwork, 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 ?


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

byte[] bytes = new byte[256];
try 
{
    int i = server.Receive(bytes);
}
0

精彩评论

暂无评论...
验证码 换一张
取 消