why could not I found my port number?

why could not I found my port number?

Post by Gary Li » Thu, 11 Oct 2001 03:31:01



I have a client and server using socket to transfer data. I give a port
number 111964.
After start program everything is fine. But I found that my program is
not using the port number I give. (lsof -p12321, 12321 is process ID).

Is that my port number too large?
What is the range of port number?

Thanks

Gary

  gary.liu.vcf
< 1K Download
 
 
 

why could not I found my port number?

Post by Lew Pitch » Thu, 11 Oct 2001 03:34:03


On Tue, 09 Oct 2001 14:31:01 -0400, Gary Liu


>This is a multi-part message in MIME format.
>--------------1FE0D12131707641CD2EA926
>Content-Type: text/plain; charset=gb2312
>Content-Transfer-Encoding: 7bit

>I have a client and server using socket to transfer data. I give a port
>number 111964.

No, you don't. TCP and UDP ports range from 0 to 65535; the port you
_say_ you use is well beyond the upper bound of that range.

>After start program everything is fine. But I found that my program is
>not using the port number I give. (lsof -p12321, 12321 is process ID).

>Is that my port number too large?
Yes
>What is the range of port number?
0 to 65535
>Thanks

>Gary

>--------------1FE0D12131707641CD2EA926
>Content-Type: text/x-vcard; charset=gb2312;
> name="gary.liu.vcf"
>Content-Transfer-Encoding: 7bit
>Content-Description: Card for Gary Liu
>Content-Disposition: attachment;
> filename="gary.liu.vcf"

>begin:vcard
>n:Liu;Gary
>tel;fax:404.927.3391
>tel;home:770.457.6736
>tel;work:404.927.7695
>x-mozilla-html:FALSE
>adr:;;675 W. PeachTree st.;Atlanta;GA;30375;USA
>version:2.1

>fn:Gary Liu
>end:vcard

>--------------1FE0D12131707641CD2EA926--

Lew Pitcher, Information Technology Consultant, Toronto Dominion Bank Financial Group

(Opinions expressed are my own, not my employer's.)

 
 
 

1. Why am I not getting the right port number?

Hi,

I have a simple client server program in which the client and
an iterative server use post number 3000. Sockets are opened
using TCP ports.

I am trying to print the port number client uses in
the following way:

    newpsock = accept(psock, (struct sockaddr *) &perfaddr, &perflen);

        printf("The port number is  %d\n", perfaddr.sin_port);

But this is what I am getting:

The port number is   2445
The port number is   2446
The port number is   2447
The port number is   2448
The port number is   2449
The port number is   2450
The port number is   2451
The port number is   2452
The port number is   2453

Why am I not able to get the right port number?

I am using Solaris 2.1.


Many thanks in advance.

- Bharat

2. Path in Prompt Problem

3. Lost a lib file. Please Help!

4. Flexfax -- "Can not find port number for 'fax' service" -- ???

5. from static to DHCP

6. Why is find so slow (Re: Why use find?)

7. Another linux boost.

8. >Why BSD port to Mac exists but not Linux port ?!?!?!?

9. "Can Not Find Qt Dirs" while building KDE, any ideas why not?

10. rlogind decrements port numbers -- why?

11. Finding client port number

12. Finding a socket's local port number