Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java Sockets: Socket.close() terminates connection different on Windows and Mac?

Situation is as follows: I have a Java Application, that communicates over TCP to a Microcontroller with TCP Stack on it. The Stack on the Controller works fine, I can sort this out.

Problem is: When I terminate my connection to the Controller, I simply use socket.close() and the connection is terminated, no problem. On my Mac, this works too, but when I check Wireshark, there is the regular termination process [FIN,ACK] - [ACK], but followed by a [TCP Dup ACK] Packet, that, so claimed by Wireshark, belongs to my [FIN,ACK] Packet. This only happens on a Mac and does not happen on a Windows machine on a VM on my mac or on my netbook...

Are there any tweaks I could use to not letting this Dup-ACK Packet to be transmitted? It actually jerks up the stack in the Controller by claiming that the closed session is still active and after 10 times connecting to the controller, the stack has no more space to accept new connections.

I'd be really thankful if someone could give me a hint!

like image 721
Patrick Meister Avatar asked Nov 14 '22 03:11

Patrick Meister


1 Answers

Well, if this is a problem in OS-provided TCP stack (which I believe it is) you may try to telnet from your mac to the device and close the connection. Just to see whether this dup ack would be still emitted. If it is, than swapping java versions/vendors (for example) won't do much good...

...oh, and maybe you'd be able to filter the offending packet with your firewall? That's a wild guess, as I actually know nothing about firewalling for MacOS...

like image 148
Anton Kraievyi Avatar answered Dec 09 '22 10:12

Anton Kraievyi