Home > Net >  Can the SOCKET do not specify a port number to communicate
Can the SOCKET do not specify a port number to communicate

Time:09-29

There are three computer A, B, C, all know their own IP address
To communicate with each other, they use UDP let system specified port
UdpClient udp=new UdpClient (new IPEndPoint (IPAddress. Any, 0));
Can this communication, or to specify port to listen to receive data

CodePudding user response:

Do not specify a port, will be randomly assigned to a port, not occupied limit is 65535
General communication requires port, so you must set up

CodePudding user response:

reference 1st floor SoulRed response:
do not specify a port, will be randomly assigned to a port, not occupied limit is 65535
General communication requires port, so you must set up

A - & gt; B A.S end (the MESSAGE, the MESSAGE Length, B.I P)//if B.I P port is zero, can't send, you need to specify the port
So the sender to send the port will need to send address, the receiver does not need to specify the port

CodePudding user response:

But the three parties all want to send and receive, is to specify a port
Will there be, competing for resulting in abnormal communication port is?

CodePudding user response:

reference m0_37646670 reply: 3/f
but three sides to send and receive, is to specify a port
Will there be, competing for resulting in abnormal communication port is?

Each computer has a 65535 ports two computers set port can be the same

CodePudding user response:

You don't agreed in west exit or east exit, how to receive?

CodePudding user response:

Middle server will typically have a notice, the two devices are even in the middle of the server, which is what we call phone, send a message or make a phone call, this is the server will tell each other what port in agreed exit is silly, of course, also do not recommend in the and so on, are generally agreed soon, this is the timeout mechanism,

CodePudding user response:

CodePudding user response:

refer to 6th floor lost temple response:
middle server will typically have a notice, the two devices are even in the middle of the server, which is what we call phone, send a message or make a phone call, this is the server will tell each other what port in agreed exit is silly, of course, also do not recommend in the and so on, are generally agreed soon, this is the timeout mechanism,

Mean A family server B and C communications accomplished by A forward?

CodePudding user response:

reference 5 floor lost temple reply:
you are not agreed in west exit or east exit, how to receive?


There are 10 computers in a local area network (LAN), each computer connected to 10 network program
If the server receives 100 connections, the IP is the same, but the port number is 100 - is not the same as

Then do not specify a port number, there will be a competition?
  •  Tags:  
  • C#
  • Related