Home > other >  C #, TCP and udp, how the network communications
C #, TCP and udp, how the network communications

Time:09-23

In the local area net, can be communication, also checked on the net, use TCP only need server IP and port networks outside, so how the server to the client, and how did the udp hair? The code on the net do not want to see, just want to see, trouble,

CodePudding user response:

Both TCP and UDP server is passive receiving data, only the client to send data to the server, when the client sends data to the server, the server can get to the client's IP and port number, server use this information to send data to the client

CodePudding user response:

reference 1st floor kinkon007 response:
both TCP and UDP server is passive receiving data, only the client to send data to the server, when the client sends data to the server, the server can get to the client's IP and port number, server use this information to send data to the client

Thank you, so how to forward, the client with the server IP and port to connect to the server of the network, server address and port is saved, the client's IP networks outside? If it is a network IP, server how to forward this message , do a few examples, before under the same network can send information, network is not at the same time we can't accept

CodePudding user response:

refer to the second floor qq_41677281 response:
Quote: refer to 1st floor kinkon007 response:
both TCP and UDP server is passive receiving data, only the client to send data to the server, when the client sends data to the server, the server can get to the client's IP and port number, server use this information to send data to the client

Thank you, so how to forward, the client with the server IP and port to connect to the server of the network, server address and port is saved, the client's IP networks outside? If it is a network IP, server how to forward this message , do a few examples, before under the same network can send information, the network is not at the same time we can't accept

Is no need to focus on the client server network or web address outside, as long as received the client's information, directly reply to the client on this address is ok, across a network segment not receive may be a firewall problem among them, even the middle through NAT translation, can reply to the client's information servers

CodePudding user response:

reference kinkon007 reply: 3/f
Quote: refer to the second floor qq_41677281 response:

Quote: refer to 1st floor kinkon007 response:
both TCP and UDP server is passive receiving data, only the client to send data to the server, when the client sends data to the server, the server can get to the client's IP and port number, server use this information to send data to the client

Thank you, so how to forward, the client with the server IP and port to connect to the server of the network, server address and port is saved, the client's IP networks outside? If it is a network IP, server how to forward this message , do a few examples, before under the same network can send information, the network is not at the same time we can't accept

Is no need to focus on the client server network or web address outside, as long as received the client's information, directly reply to the client on this address is ok, across a network segment not receive may be a firewall problem among them, even after NAT translation among, the server is also can reply the client information

Thank you ,,,,,,,,,,, I am discovering just dig myself again