C#-Server / C++ Client: Socket.Accept() never finishes -


i'm writing simple c++ client should connect c# server. and, while client runs throught fine , states sent bunch of bites, c# server never gets past listener.acceppt():

console.writeline("waiting connection..."); // program suspended while waiting incoming connection. socket handler = listener.accept(); 

i took server source here: microsoft msdn: synchronous server socket example

the client code use can found here: microsoft msdn: complete winsock client code

i checked server according c# client, worked fine. checked return values of client, looked pretty plausible. i'd guess problem lies somewhere in how c++ / c# handle details.

i tried wireshark find hints, mysteriously there absolutely no trace of communication on used port (11000).

where should start looking solve issue?

update: communication @ moment runs locally. tried ipaddress (from ipconfig) , 127.0.0.1 both server , client.

i have 1 network adapter installed, use ip adress. client checks getaddrinfo(argv[1], default_port, &hints, &result) , returns valid information (e.g. tcp protocol). connect() returns 0, should ok.

update 2: tried different combinations of c++/c# server-client-setups:

  • c++-server, c++ client: works
  • c++-server, c# client: works
  • c#-server, c# client: works
  • c#-server, c++ client: not work
  • c#-server, putty: works

update 3: tried wireshark on other server-client constellations, neither of them did show traffic on tcp.port == 11000, although did work (see update 2). looks wireshark not show results, because local (see wireshark localhost traffic capture)

i had same problem. connection winsock asynchronous. , example in c# using synchronous. have use asynchronous example communication c++ code.

i used 2 examples!

c sharp server https://msdn.microsoft.com/en-us/library/fx6588te(v=vs.110).aspx

c plus plus client https://msdn.microsoft.com/en-us/library/windows/desktop/ms737591(v=vs.85).aspx


Comments