Click here to Skip to main content
15,074,483 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
can the server program have 2 different TcpListner ?
while the 2 TcpListner have the same IP but different Port
all that for the SAME program

can make it in this way ?


Yes, as long as the port is different.
Henning Dieterichs 10-Apr-12 18:20pm
We answered in the same second ;)
wizardzz 10-Apr-12 18:25pm
Yes, but you bothered to mention the UdpListener part. I knew that, but left it out to avoid potentially confusing the poster.
maxpower12345 10-Apr-12 18:29pm
thanks a lot :)
Sergey Alexandrovich Kryukov 10-Apr-12 22:56pm
Right, a 5.
Yes, it is possible as every tcp network packet has an IP, Port and Protocol-Identifier.
It is even possible to run a TcpListener and an UdpListener on the same port, too.
But you cannot bind two listener of one type (tcp or udp) to the same port.
maxpower12345 10-Apr-12 18:30pm
thank you :)
Sergey Alexandrovich Kryukov 10-Apr-12 22:56pm
Right, a 5.
maxpower12345 11-Apr-12 16:32pm
it's give me an warning for the second "TcpListner"
the warning is : TcpListner Form1.TcpDB
Unreachable code detected

what that mean ?
please some help

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900