SCOUG Logo


Next Meeting: Sat, TBD
Meeting Directions


Be a Member
Join SCOUG

Navigation:


Help with Searching

20 Most Recent Documents
Search Archives
Index by date, title, author, category.


Features:

Mr. Know-It-All
Ink
Download!










SCOUG:

Home

Email Lists

SIGs (Internet, General Interest, Programming, Network, more..)

Online Chats

Business

Past Presentations

Credits

Submissions

Contact SCOUG

Copyright SCOUG



warp expowest
Pictures from Sept. 1999

The views expressed in articles on this site are those of their authors.

warptech
SCOUG was there!


Copyright 1998-2024, Southern California OS/2 User Group. ALL RIGHTS RESERVED.

SCOUG, Warp Expo West, and Warpfest are trademarks of the Southern California OS/2 User Group. OS/2, Workplace Shell, and IBM are registered trademarks of International Business Machines Corporation. All other trademarks remain the property of their respective owners.

The Southern California OS/2 User Group
USA

SCOUG-HELP Mailing List Archives

Return to [ 24 | July | 2004 ]

<< Previous Message <<


Date: Sat, 24 Jul 2004 23:02:50 PDT7
From: Peter Skye <pskye@peterskye.com >
Reply-To: scoug-help@scoug.com
To: scoug-help@scoug.com
Subject: SCOUG-Help: Help with netstat -s

Content Type: text/plain

=====================================================
If you are responding to someone asking for help who
may not be a member of this list, be sure to use the
REPLY TO ALL feature of your email program.
=====================================================

Harry Motin wrote:
>
> I don't understand what a "Foreign Port" of 0 means.
> And I don't know what a "Foreign Host" of 0.0.0.0 means.

I haven't done a lot of socket programming and I'm no expert, but this
might help.

When I want to wait for some other machine to connect to me, I open a
socket on a specific port (for example, on port 25 if I'm doing SMTP
stuff) and then I "Listen" on that socket. Since no other machine has
tried to connect to me yet, netstat -s should show that I am in the
"Listen" state on port 25 and there is nobody connected to me (hence the
zero values).

When some other machine wants to transfer a mail message to me, it will
contact my IP address on port 25 (the SMTP standard port, look in your
\MPTN\ETC\SERVICES file) and my TCP stack will tell my program that I
have a connection. At that point, netstat -s will no longer report the
state as "Listen" but instead will say something like "Active" and will
report the foreign machine's IP address and port.

The IP address gets the packets to the proper machine. The port tells
the TCP stack where to send the packets when they arrive. The socket is
the table entry number in the TCP table where each connection's
information is kept.

When you send a packet you open a TCP socket and send to the foreign
machine's IP+port. To receive packets you open a socket which listens
on a specific port and you get whatever is sent to that port. This is
why each protocol has a specific port number -- FTP 21, SMTP 25, HTTP
80, POP3 110 -- so your programs can tell the TCP stack which packets
they are to receive.

The TCP stack has several tables but the main one is the one shown by
netstat -s. netstat -s tells you all of your current sockets plus what
local port they are connected to, plus (if there's a connection) what
the foreign machine's IP address and port are. The socket number is
internal to each machine so the foreign machine's socket isn't reported
back to you.

- Peter

=====================================================

To unsubscribe from this list, send an email message
to "steward@scoug.com". In the body of the message,
put the command "unsubscribe scoug-help".

For problems, contact the list owner at
"rollin@scoug.com".

=====================================================


<< Previous Message <<

Return to [ 24 | July | 2004 ]



The Southern California OS/2 User Group
P.O. Box 26904
Santa Ana, CA 92799-6904, USA

Copyright 2001 the Southern California OS/2 User Group. ALL RIGHTS RESERVED.

SCOUG, Warp Expo West, and Warpfest are trademarks of the Southern California OS/2 User Group. OS/2, Workplace Shell, and IBM are registered trademarks of International Business Machines Corporation. All other trademarks remain the property of their respective owners.