Reputation: 119
If I close the application the socket will automatically close as well or do I need to specify that if the user close the application to close the socket stream as well?
Also another question. I wanted to ask related to sockets: if I connect to an IP via sockets shouldn't I be able to see that I'm connected to it via the resource monitor in the task manager? Because I've connected to a host using its IP and open port and I don't see it on the TCP connection list.
Upvotes: 0
Views: 80
Reputation: 6247
Yes, if the application terminates, the socket will close. Ideally you should close the socket when you're done using it. Keep in mind if you don't properly close or flush the socket before terminating your application, any data in the buffer or stream attached to the socket may not be sent.
Upvotes: 2