c# - In the IPv6(NAT64) environment,networkStream.BeginRead does't work -


the following code works in ipv4,and,in ipv6(nat64) environment,it can connect server , send message success,it can capture data server, but,the callback onread never executed.

it's been bothering me long time.

private tcpclient client = null; private const int max_read = 8192; private networkstream outstream = null; private byte[] bytebuffer = new byte[max_read];   public void connectserverbyip(string ip, int port) {      client = new tcpclient(addressfamily.internetworkv6);       client.sendtimeout = 1000;     client.receivetimeout = 1000;     client.nodelay = true;      ipaddress ipaddr = ipaddress.parse(ip);      try {         client.beginconnect(ipaddr, port, new asynccallback(onconnect), null);     } catch (exception e) {         close(); debug.logerror(e.message);     }  }  void onconnect(iasyncresult asr) {     outstream = client.getstream();      client.getstream ().beginread (bytebuffer, 0, max_read,new  asynccallback(onread), null);      networkmanager.addevent(protocal.connect, new bytebuffer()); }  void onread(iasyncresult asr) {     debug.log ("hello~"); } 


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -