Main Site Documentation

G400 sockethandling goes wrong


sometimes there are network errors. any server socket goes invalid.
on my icmp implementation I plan to recreate (null assign, open) the invalid sockets and get following error:
WSA 10055, no buffer space available
WSA 10060, connect timeout

the exceptionhandling is working, but inspite of the correct handling … the error info is only flushed into my console at vs2013 debug session. the exception object itself has no information to watch on.

what is the correct way to cleanup sockets, afterwards they have been invalid?

in addition, if I force gc, there is a lot of memory space valid

in addition I’d want to tell infos about my application. the application uses ipv4 icmp raw protocol. sometimes on pinging an other valid device there is no reply and the client-socket goes wrong with an exception. I never plan to reboot so I have to manage a very clear and correct rebuild of client socket.

if there is no socket readoperation (after write) for all data in general you get big problems. in each case i manually read until the amount of valid and available data is 0. on pinging internet domains i get socket errors. this also leads to a situation with no chance to recreate the client socket. the function itself which raises the exception is receiveFrom.

the same function works in a lokal network fine


Just because there is memory in the heap does not mean its usable by the networking stack. That said, the best way to diagnose network issues is to have Wireshark or a similar tool capture the traffic to see what’s happening. In some error cases the best way to resolve them is to dispose of and recreate the network interface and any associated sockets.