Re: How to determine the local port?
- From: CBFalconer <cbfalconer@xxxxxxxxx>
- Date: Tue, 24 May 2005 00:31:49 GMT
anketm@xxxxxxxxx wrote:
>
> I am writing a simple client using UDP sockets.
> I am wondering if there is any way to determine what local port a
> socket was bound to when bind() is not explicitly called.
>
> This is what my program looks like:
>
> sock = socket(PF_INET, SOCK_DGRAM, 0);
> sendto(sock, message, strlen(message) + 1, 0, (struct sockaddr *)
> &server, sizeof(server));
>
> Note that bind() was not called, and the socket was arbitrarily(?)
> bound to a local port by the kernel. How do I determine what port
> it was bound to?
This is all off topic here. See the references in my sig below,
especially the first two.
--
Some useful references about C:
<http://www.ungerhu.com/jxh/clc.welcome.txt>
<http://benpfaff.org/writings/clc/off-topic.html>
<http://www.eskimo.com/~scs/C-faq/top.html>
<http://anubis.dkuug.dk/jtc1/sc22/wg14/www/docs/n869/> (C99)
<http://www.dinkumware.com/refxc.html> (C-library}
<http://gcc.gnu.org/onlinedocs/> (GNU docs)
.
- References:
- How to determine the local port?
- From: anketm
- How to determine the local port?
- Prev by Date: Re: Read pixels from a PGM/PPM Image
- Next by Date: Re: I've forgotten my C: passing 2-D matrices
- Previous by thread: Re: How to determine the local port?
- Next by thread: Re: How to determine the local port?
- Index(es):
Relevant Pages
|
|