Socket or serial port programming


hi devs!

i wanted communication bioaccess device. used socket programming gets hanged , shows following error

connection closed forcefully

>so, please me out if used method(code shown below) proper or not. or should have use method receive data device.

tell me if below code not proper. should receive data device.

someone suggested me using serial port programming have no knowledge it.

please me out situation.

          socket sock = new socket(addressfamily.internetwork, sockettype.stream, protocoltype.tcp);
            var ipadd=ipaddress.parse("192.168.1.1");              ipaddress add=new ipaddress (ipadd);              endpoint ep=new ipendpoint (add,80);              sock.connect(ep);              if (sock.connected)              {                  string = null ;                  byte[] rec=new byte [256];                  int32  b = sock.receive(rec, rec.length, 0);                  while (b > 0)                  {                      b = sock.receive(rec, rec.length, 0);                      = + asciiencoding.ascii.getstring(rec, 0, b);                    }                  sock.shutdown(socketshutdown.both);                  sock.close();              }
in advance!!!!

hi,

your question more towards programing, there dedicated forum answers programing related queries

please post query under below link , navigate appropriate forum.

http://social.msdn.microsoft.com/forums/en-us/categories

 

 

 



Windows Server  >  Windows Server General Forum



Comments

Popular posts from this blog

WIMMount (HSM) causing cluster storage to go redirected (2012r2 DC)

Failed to delete the test record dcdiag-test-record in zone test.com

Azure MFA with Azure AD and RDS