gg-(E-Mail Removed) wrote:
> Given a socket which is being used for an established TCP connection,
> is there any way to determine from user space under Linux 2.4/2.6 which
> side originated the connection? I'm working on some low-level code, so
> all I get is the socket. The solution doesn't have to be portable, so I
> could use, say, data from the tcp_info structure, but unfortunately
> none of those fields seem to indicate the originator.
>
> Thanks!
>
> G
>
You may be able to infer it from the port numbers. The originator
always calls from port numbers above 1024. And you may happen to
know which port the server is listening on. Otherwise, I think
you are out of luck - an open TCP connection is symmetrical.
Steve