Home > Software engineering >  The Socket implementation problem of the communication across the network
The Socket implementation problem of the communication across the network

Time:10-15

I use Sun Xin socket knowledge, made a C/S chat software, in the laboratory of wireless networks in the LAN test can normal communication, then, using QQ to the client to send me a nonlocal classmates, test the performance of chat software, however, the problem appears, I LAN Ip address is 192.168.1.101. My classmate LAN Ip is 192.168.1.101. This causes can't communicate, then, I set my LAN Ip to 192.168.1.102, still can't communicate,
Later, just know we all confined to the IP address of the local area network (LAN), are not implicated in the network, [the main IP where to fill in, don't know the network seems to be only an IP Socket can fill in the item,]
I am very confused now, murphy SOcket can only identify the LAN IP, in that case, the meaning of the SOcket network communication is greatly discount,,,

How to implement, Socket, across the network and the communication between the foreign students

CodePudding user response:

First of all, you must first understand the private IP and the difference between public IP,
Second about NAT recommend you look at the article,
http://hwycheng.bokee.com/2404843.html

CodePudding user response:

Know that the network IP and port, IP38 can see the network IP, but if you are a router to the Internet, you need to do port mapping.

CodePudding user response:

refer to the second floor xiaohuh421 response:
IP and port can, know the network IP IP38 can see the network, but if you are a router to the Internet, you need to do port mapping.

You mean, if the IP address of the computer display is the network address, rather than 192.168. *. * local area network (LAN), in that case, directly to the network IP as the target IP address, can

CodePudding user response:

Yes, as long as know your computer can be directly like LAN IP networks outside the communication, but there is a premise, your computer is independent IP, if it is behind a router, it needs to fracture mapping.

Of course there are other complicated technology, do not need to be fracture mapping, such as P2P technology.

reference HUABAOREN reply: 3/f
Quote: refer to the second floor xiaohuh421 response:

Know that the network IP and port, IP38 can see the network IP, but if you are a router to the Internet, you need to do port mapping.

You mean, if the IP address of the computer display is the network address, rather than 192.168. *. * local area network (LAN), in that case, directly to the network IP as the target IP address, can it

CodePudding user response:

Among this knowledge is more, you still have a long way to go

CodePudding user response:

Socket programming is only a fixed address network communications, broadband outside your home broadband is a dynamic address, so no sense

As for, the outside network terminal as a site of local area network (LAN), is another topic, called virtual network.

On the world a tsu computers on the Internet and your computer socket is used to implement communication

Need to use technology in a virtual network, name is called point to point in P2P,

There is nothing wrong with your program, it is the population of China is too much, not enough points fixed IP address

CodePudding user response:

reference 4 floor xiaohuh421 response:
yes, as long as know your computer can be directly like LAN IP networks outside of the communication, but there is a premise, your computer is independent IP, if it is behind a router, it needs to fracture mapping.

Of course there are other complicated technology, do not need to be fracture mapping, such as P2P technology.

Quote: refer to the third floor HUABAOREN response:

Quote: refer to the second floor xiaohuh421 response:

Know that the network IP and port, IP38 can see the network IP, but if you are a router to the Internet, you need to do port mapping.

You mean, if the IP address of the computer display is the network address, rather than 192.168. *. * local area network (LAN), in that case, directly to the network IP as the target IP address, can it



Thank you very much and knows a bit of Socket communication knowledge

CodePudding user response:

reference 5 floor tanyufeng_521 reply:
among this knowledge is more, you still have a long way to go


You mean, you also need to study/computer network TCP/IP, the aspects of professional knowledge, can not simply rely on Sun Xin tutorial, socket communication technology that can be mastered

CodePudding user response:

refer to 6th floor gz_qmc response:
socket programming is only a fixed address network communications, broadband outside your home broadband is a dynamic address, so it makes no sense

As for, the outside network terminal as a site of local area network (LAN), is another topic, called virtual network.

On the world a tsu computers on the Internet and your computer socket is used to implement communication

Need to use technology in a virtual network, name is called point to point in P2P,

There is nothing wrong with your program, the population of China is too many, fixed IP address not enough points


Thank you for your explanation, I know myself still lack of Internet knowledge, need for additional virtual network technology [] [] P2P technology

CodePudding user response:

refer to the eighth floor HUABAOREN response:
Quote: refer to the fifth floor tanyufeng_521 reply:

Among this knowledge is more, you still have a long way to go


You mean, you also need to study/computer network TCP/IP, the aspects of professional knowledge, can not simply rely on Sun Xin tutorial, socket communication technology that can be mastered

Yes, Sun Xin that set of video about the role of network programming just sprang out, just like it when it comes to database programming, to really do web programming, database programming, also want to learn more related knowledge,

CodePudding user response:

Ha ha, basic computer that you didn't learn! Or open this lesson, you didn't listen to

CodePudding user response:

This,,, there is still a long way to get started,,, the original poster

CodePudding user response:

Learning, the problem is I want to know,,,

CodePudding user response:

I can only say that you! So lovely

CodePudding user response:

Everyone a great god, the novice to learn Windows network programming, see what book is good, please give advice or comments

CodePudding user response:

It is recommended to use peanut shells at www.oray.com

CodePudding user response:

The mre university didn't mr.brown, take a 192 such addresses you want to and have the legal address of the Internet communication

CodePudding user response:

Basic computer that you didn't learn!

CodePudding user response:

The two of you through the VPN can direct communication,

CodePudding user response:

As the upstairs said, that QQ is how to communicate?

CodePudding user response:

QQ communication are intermediate server as the control center, and then communication bettas are actually the public IP communication server

CodePudding user response:

This way, you need to do the port mapping network to the public,
Your basic knowledge of slightly, to master the basic knowledge of network to do socket programming,,
If do network transmission, you must use the TCP protocol based on UDP (cannot penetrate Intranet) and server port must be on the public network,

Intranet through image interpretation: we can upload the file to QQ temporary stored on the server, we can also download the submission to the QQ file on the server to download (file, the file transfer is through),
If we don't install QQ, tencent's server is unable to transfer files directly to our individual hosts (we do not submit an application for download, along with his age is the skill, he can't be through),
  • Related