For a TCP connection, given a packet, i need a way to get the address of the socket which sent the packet
Right now the best way i can think of is:
- Extract TCP header from Packet
- Get Source IP and Source Port from TCP header
- Create a temporary InetSocketAddress object using the Source IP and Source Port
- Use the ConvertTo function of the InetSocketAddress class to get the Address
Is there a better, more direct way of doing this?
Any help is appreciated, thanks.