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