Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
"server-tcpip-sockets" and ports
2004-04-22, 06:43 AM
Post: #1
"server-tcpip-sockets" and ports
Hi,

question about "server-tcpip-sockets" and ports

1. I wrote a small programm to isolate the problem
2. I send the source-code to you
3. the problem is that on Interix !!more!! than on
server-process can listen on the !!same!! port
4. first the output of the test-tool as introduction

LINUX
-----

dev1usr@linux02:> ./socket.run localhost 5001
M> MSG start server on host=localhost with port=5001
M> MSG start 1. server
M> MSG start 2. server
M> ERR main: Address already in use

INTERIX
-------

noadmin@win01:> ./socket.run localhost 5001
M> MSG start server on host=localhost with port=5001
M> MSG start 1. server
M> MSG start 2. server
M> MSG netstat -a | grep 5001
TCP win01:5001 win01:0 ABHREN
TCP win01:5001 win01:0 ABHREN

5. Linux: the starting of the second listener fails with
"Address already in use"
Interix: everything seems to be ok

6. question: why does this happen?


mfg

aotto
Find all posts by this user
Quote this message in a reply
2004-04-22, 07:06 AM
Post: #2
RE: "server-tcpip-sockets" and ports
how many network connections (ie network drivers, ...) do you have installed on your Windows box ?

How did you do the bind() on the socket before the listen() ?
What parameters did you use ?
Find all posts by this user
Quote this message in a reply
2004-04-22, 10:59 PM
Post: #3
RE: "server-tcpip-sockets" and ports
Hi,

if you ave an email-adress I can send the test-tool to you


mfg

aotto
Find all posts by this user
Quote this message in a reply
2004-04-22, 11:06 PM
Post: #4
RE: "server-tcpip-sockets" and ports
Hi,

the code as email
(save as email and open it)

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
From aotto@t-online.de Thu Apr 22 16:49:22 2004
From: Andreas Otto NOSPAM
Organization: IPN
To: tools@interopsystems.com
Subject: "server-tcpip-sockets" and ports
Date: Thu, 22 Apr 2004 16:49:22 0200
User-Agent: KMail/1.5.4
X-KMail-Identity: 636090913
MIME-Version: 1.0
Content-Type: Multipart/Mixed;
boundary="Boundary-00=_yt9hAKL1nQ7x03k"
Message-Id: <200404221649.22368.aotto@t-online.de>
Status: RO
X-Status: S
X-KMail-EncryptionState:
X-KMail-SignatureState:


--Boundary-00=_yt9hAKL1nQ7x03k
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline


Hi,

the test-tool for you


mfg

aotto

--Boundary-00=_yt9hAKL1nQ7x03k
Content-Type: application/x-tgz;
name="socket.tgz"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="socket.tgz"

H4sIAJvah0AAA 0aa3PaSDJfrV/Rhx8BF2/beBfH2SOAEy4YXID3kk1SlBADTEVInB6OvXv5Pfsn
78N1z4xACLCziUPq6tSV2GKmX9PvEXZt4yPzck J Tzx/nTkxP8nc flo7F78Kx/K3gSQGRCohU
zCNeoVAqnTyBk qlQLf9XQH4MmQ3RR817kHjznuNhTaLrjS/7pjTL5bEPx1/xdL WLs/21A2P8N
y2MOv83c/lTKTh5RRh6dW1L Xuf/k1Ip8P9xvnSE Cf5IuZ//hF12Aj/5/7PHWpwCNAzzBe6yyAD
rmPkNgYF4gr0ZDUFRfQY4jeuWvTTGjOLM98Z MyxYfQfB64cnf3OXW5bruVPkcdHQZr5KhCkNT4z
sxkUlYWKNXSY7kLb82yxd21OmeV6ju7iKY4keubouPjTz/AbZw6zBswZf6sCumky6DBj4jG4sZ0B
m imxyzcy2na7pCNuMWgX2k2 932dada17y7GcNl4JYHZFSTWX3vTNN tNcXEHa1yS3/NsOP0NNT
/SN7NBkP5X/p6Dia/8XTfJz/24DdP7XdP /L/0hQaIrgKysAkX5lAhLppgpAe5EKINBXK8A3KrCp
AqBVtGoVBJzD2DC0Rqvbw0qAn3IYVrkBt3Ic1UMGWucyQBTLzlS7fF1rdHbOYS pyFKQGW6lSmxw
9WO2/4f7f6EQyf/jk9PjOP 3AQ/2/3BQxO1/c/v/0Y78Stg06j3mAPBw/z J9v TQtz/twIP9v9o
UMQDwPccAMTn6cchdyAz20ZNUa6 RM OuPl4M38YHsj/4vFpNP PEOL83wbc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q Yo
Smfn3vlswwCmCAOkB0eteTRiCLors9YfS2GPqYACfVfEWy4HhSwYQqqinBtTyJ /0U2qwSEtxtR
t4fl9zIN VQKrZ1PQbQIi/FWGfSi3633Lmr4UOtXm 36m3pVmW5jui7PwqlA2eJCWWEjZRk6D71k
PgvPUQ/6tX7drdNAsnAtHEheaW0nKZ/mA1UgY8CtoeIX9Wx4WNs0o4WHJsUTm3OmQLG6s5BC3ZRZ
c70vK2 q7VZrHm/SGEdZ SYWu4MkjHIWjkG Ud oRvhYVZsii9BEedadsZEWQ/3hIX24SS0P2eH4
/bLwpY2Vq8LyzK/t4id1i0Kl253 ZfdlX9yi8FotORCtOFp/6o7fLWN9COIrn0WmXE758shq5sgv
3EYnJKcdheuLa83wcuiNknMR6YgmaUi8t667lZd12HfFECR0T6SFlXB0CpWkhcOK4fIpp2yJX/gg
d9TErns2T4qNYsBIKUSORB0oRBBTpg2FDDE7R00 4UAruJzv8/dWYumOdwajkem7Ewyooe17KdWj
1l0TDxaRH2awWmSEAk/dzSoirkR6T4G3okFIAVkmD0LFdCPT4jcwnZcewRnwVkL5tYgqvDdMdWv4
DkNNOWUeDWorjVvphCKEjA7/hjGOhrDPE3NDrVF93xUOUUyCSiTuGsnFYiQ1u9fVar3bTS3yuigT
e6S446FxGcMxlOHlQNY8fO9P R/9ci2GGGKIIYYYYoghhhhiiCGGGGKIIYYYYoghhhhiiCGGGLYM
/wXTXAP7AFAAAA==

--Boundary-00=_yt9hAKL1nQ7x03k--
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Find all posts by this user
Quote this message in a reply
2004-04-23, 12:50 AM
Post: #5
RE: "server-tcpip-sockets" and ports
Hi,

this is an additional "socket" problem
every!! user kann open a listen-socket on low-ports
use the "socket-test-tool", post befor, to test

LINUX:

dev1usr@linux02:> ./socket.run localhost 24
M> MSG start server on host=localhost with port=24
M> MSG start 1. server
M> ERR main: Permission denied

INTERIX:

noadmin@win01:> ./socket.run localhost 24
M> MSG start server on host=localhost with port=24
M> MSG start 1. server
M> MSG start 2. server
M> MSG netstat -a | grep 24
TCP win01:24 win01:0 ABHREN
TCP win01:24 win01:0 ABHREN


mfg

aotto
Find all posts by this user
Quote this message in a reply
2004-04-23, 05:19 AM
Post: #6
RE: "server-tcpip-sockets" and ports

every!! user kann open a listen-socket on low-ports


Correct. WinSock does not restrict access to ports.
Find all posts by this user
Quote this message in a reply
2004-04-23, 05:29 AM
Post: #7
RE: "server-tcpip-sockets" and ports

the code as email
(save as email and open it)


Sorry, we don't have time to do support/porting for free.
A good Winsock programming book should explain the differences
between Winsock and UNIX implementations. This may help you.
Find all posts by this user
Quote this message in a reply
2004-04-23, 06:43 AM
Post: #8
RE: "server-tcpip-sockets" and ports
Mark is right that you should reference a Winsock book for some
background information. The reason for this is that the WinSock
TcpIp driver is used by both Interix and Windows. This allows for
coordination between the two. So the underlying rules apply to
both Interix and Windows because of how the driver is implemented.

On Unix machines ports 1024 and lower are restricted to root.
Winsock doesn't make this distinction because of it's mis-spent youth.
So this is not an error. It's just the way it is.

For multiple processes camping on the same port this too is allowed.
The rule is first there gets the port. You have more than one process
listed as camped there, but the first one wins. To protect against this
to a certain degree I extended inetd to do port camping to prevent spoofing
by an ordinary user. There are comments in the file "/etc/inetd.conf" which
you can read.
Find all posts by this user
Quote this message in a reply
2004-04-23, 10:18 AM
Post: #9
RE: "server-tcpip-sockets" and ports
Hi,

thanks for the answer ...
yes you are right, I have no "winsock" background
even I have not as mutch windows backgroud too.

but this was was answer I need:

1) multiple listeners on same port are allowed ...
even if the first on wins but the second
one does not get an "error" message.
-> the process just wait forever

2) low ports are allowed, ok
I have only done a comparison between Interix
and Linux

mfg

aotto
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)