1
Network / Re: Difference between remote port and bind port
« on: December 15, 2013, 02:03:56 am »
After researching I found the following on Wikipedia:
I still don't quite understand the concept of the source port though. If the receiver is to reply to the sender using the source port then surely the sender must have already bound to the source port? I do not see any way of getting/setting the source port when sending something using SFML.
Edit: Okay so after reading the documentation like I should have done in the first place I found that the source port is whatever port the sender's socket was bound to. I'm not quite sure as to the behaviour when the sender's socket is not bound but it shouldn't matter as the receiver cannot respond to a sender that is not bound.
Quote
Source port number
This field identifies the sender's port when meaningful and should be assumed to be the port to reply to if needed. If not used, then it should be zero. If the source host is the client, the port number is likely to be an ephemeral port number. If the source host is the server, the port number is likely to be a well-known port number
I still don't quite understand the concept of the source port though. If the receiver is to reply to the sender using the source port then surely the sender must have already bound to the source port? I do not see any way of getting/setting the source port when sending something using SFML.
Edit: Okay so after reading the documentation like I should have done in the first place I found that the source port is whatever port the sender's socket was bound to. I'm not quite sure as to the behaviour when the sender's socket is not bound but it shouldn't matter as the receiver cannot respond to a sender that is not bound.