linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* TCP port numbers
@ 2004-11-01  3:33 ych43
  2004-11-01 10:39 ` Jan Engelhardt
  2004-11-01 12:38 ` Neil Horman
  0 siblings, 2 replies; 3+ messages in thread
From: ych43 @ 2004-11-01  3:33 UTC (permalink / raw)
  To: linux-kernel

Hi,
 I got one question about unix socket functions. I have two machines (called A 
and B). I use A to telnet B, get the root password of B. Is there any unix 
socket function I can use to get the port number of A on B. Obviously, the 
port number of B is 23. I want to use a socket function implemented on B to 
get the port number of A because a TCP connection is established between them.
  I greatly appreciate it if you help me. Thank you in advance.
  Xue


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: TCP port numbers
  2004-11-01  3:33 TCP port numbers ych43
@ 2004-11-01 10:39 ` Jan Engelhardt
  2004-11-01 12:38 ` Neil Horman
  1 sibling, 0 replies; 3+ messages in thread
From: Jan Engelhardt @ 2004-11-01 10:39 UTC (permalink / raw)
  To: ych43; +Cc: linux-kernel


>Hi,
> I got one question about unix socket functions. I have two machines (called A
>and B). I use A to telnet B, get the root password of B. Is there any unix
>socket function I can use to get the port number of A on B. Obviously, the

The 'struct sockaddr_in' you're filling in on B's site with the call with
accept() also fills in the port number.

>port number of B is 23. I want to use a socket function implemented on B to
>get the port number of A because a TCP connection is established between them.
>  I greatly appreciate it if you help me. Thank you in advance.
>  Xue


Jan Engelhardt
-- 
Gesellschaft für Wissenschaftliche Datenverarbeitung
Am Fassberg, 37077 Göttingen, www.gwdg.de

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: TCP port numbers
  2004-11-01  3:33 TCP port numbers ych43
  2004-11-01 10:39 ` Jan Engelhardt
@ 2004-11-01 12:38 ` Neil Horman
  1 sibling, 0 replies; 3+ messages in thread
From: Neil Horman @ 2004-11-01 12:38 UTC (permalink / raw)
  To: ych43; +Cc: linux-kernel

ych43 wrote:
> Hi,
>  I got one question about unix socket functions. I have two machines (called A 
> and B). I use A to telnet B, get the root password of B. Is there any unix 
> socket function I can use to get the port number of A on B. Obviously, the 
> port number of B is 23. I want to use a socket function implemented on B to 
> get the port number of A because a TCP connection is established between them.
>   I greatly appreciate it if you help me. Thank you in advance.
>   Xue
> 
I think getpeername is the library call you are looking for
HTH
Neil
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/


-- 
/***************************************************
  *Neil Horman
  *Software Engineer
  *Red Hat, Inc.
  *nhorman@redhat.com
  *gpg keyid: 1024D / 0x92A74FA1
  *http://pgp.mit.edu
  ***************************************************/

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-11-01 12:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-01  3:33 TCP port numbers ych43
2004-11-01 10:39 ` Jan Engelhardt
2004-11-01 12:38 ` Neil Horman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).