I initially opened a socket port, after a period of time, the running PHP script was turned off (the socket port is not turned off), when the script rerun, how to avoid the same IP + port repeatedly open the socket port caused by the error?? And how
I initially opened a socket port. after a while, I disabled the php script (the socket port was not closed). when the script was re-run, how can I avoid repeated opening of socket ports with the same ip address and port ?? And how to reconnect to
There is an integrated TCL interpreter program (called TT bar) to execute a script with exec to start a process (PP), the TT itself creates a socket port to communicate with other programs. At this point, the shutdown tt,pp is still running, use
One, what is the port multiplexing:
Because in the implementation of Winsock, the binding of the server can be multiple-bound, in determining the use of multiple bindings who, according to a principle whose designation is most clearly handed to who,
Scene:In the use of Linux process, we often use Telnet to test the other server a port is open, but Linux is not installed by default Telnet client, many times the temporary installation of Telnet will be more troublesome, this time can be used in
Port numberProtocol Port number:The full name of the port number is the protocol port number, it is used for the application layer and transfer into the interaction, when creating a socket need to know the IP address and port number, here the port
This article mainly introduces the socket Port Redirection example implemented by python. the implementation function is to enable file sharing on port 12345, at this time, I also want to access this sharing through port 8000 at the same time, which
Wrote two small programs, mainly for Linux and Windows under the TCP port detection, my own telnet can not meet the needs of my batch detection, in my eyes this type of port detection program is the most critical is the time-out limit, if the port
1. What is port multiplexing:
In the implementation of WinSock, the server can be bound multiple times. When determining who is using the multiple bindings, according to one principle, the person who specifies the person who submits the package
Linux Network Programming 7 -- use TCP to implement mutual chat and linux Network ProgrammingIdeas
The main thread is responsible for sending messages, and the other thread is responsible for receiving messages. This is true for both the server and
IdeasThe main thread is responsible for sending messages, and the other thread is responsible for receiving messages. This is true for both the server and the client.AttentionThe port will not be shut down immediately after a party closes the socket
I need to judge if the port is occupied by the socket
Internal static bool Portinuse (int port)
{
bool inUse = false;
Ipglobalproperties ipproperties = Ipglobalproperties.getipglobalproperties ();
In many cases, we need to use a fixed IP and port number to communicate, and by default, the client side of the port number is not fixed, by the system automatically allocate idle port number to communicate;
But in many cases, some services to write
Scenario: on the port12345Enable file sharing.8000The port also accesses this share.
According to my previous articleArticle(Http://www.cnblogs.com/MikeZhang/archive/2012/02/11/httpFileSharePythonAndGo.html),
You can easily12345Enable sharing.
Write the socket program in Python and listen to the service on the specified port:Import socketSock = Socket.socket (socket.af_inet, socket. SOCK_STREAM)Port = 8080Sock.bind (("', port)")Sock.listen (1)print ' Listening on port:%s '% portWhile True:
You can easily turn on sharing on port 12345 with the following effects:
To implement the functionality I want, just redirect the port and the code is as follows:
The code is as follows:
#! /usr/bin/python'''File:redirect.pyAuthor:mike'''
You can easily enable sharing on port 12345. The effect is as follows:
To implement the desired function, you only need to redirect the port. The Code is as follows:
Copy codeThe Code is as follows:#! /Usr/bin/python'''File: redirect. pyAuthor: Mike'
In TCP applications, the communication between the two parties is connection-oriented, and multiple connections on the same computer must be different from each other. In the TCP protocol, [Source IP + Source Port + Destination IP + Destination Port]
Can be easily opened in port 12345 sharing, the effect is as follows:
To implement the functionality I want, just redirect the port, and the code is as follows:
Copy Code code as follows:
#! /usr/bin/python
'''
File:redirect.py
Use Socket.io to create a Socket.io server. However, the server relies on an HTTP server that has already been created.After the HTTP server is running, use the Listen method to attach an Socket.io server to the HTTP server.var sio=require
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.