Alibabacloud.com offers a wide variety of articles about socket operation on non socket, easily find your socket operation on non socket information here online.
I. routing socket
1. Overview
Three types of operations are supported in the router interface.
1) The process can send messages to the kernel through the write router interface.
2). The process can read messages from the kernel on the router interface. This is the way in which the core notification process has received and processed an ICMP redirection message.
3) The process can use the sysctl function to obtain the route table or list all configured
second type of approach is to use the port multiplexing, do the port binding before using Listensocket.setsocketoption (Socketoptionlevel.socket, socketoptionname.reuseaddress, 1); Set the bound port to reusable, shielding the exception directly.
I am lazy, directly using the port multiplexing, the code is less AH. Although the technology is not very understanding, but there should be some of the resources are not released, if the frequent use of the server will affect the performance of "Port
resolveprint ' Hostname could not to be resolved. Exiting 'Sys.exit ()print ' Ip address of ' + host + ' is ' + remote_ip
#Connect to remote serverS.connect ((REMOTE_IP, Port)
print ' Socket Connected to ' + Host + ' on IP ' + remote_ip
#Send some data to remote servermessage = "get/http/1.1\r\n\r\n"
Try:#Set the whole stringS.sendall (Message)Except Soc
this socketDataInputStream input=new DataInputStream (Clientsocket.getinputstream ());FILE://creates a new data input stream to read data from a specified input streamint C;String response; See, this is the dead loop where the client listens for user input all the time.while ((c= System.in.read ())!=-1)//takes the input string from the screen and decomposes it into characters{Output.write ((byte) c);if (c== '/n ')//If the character is carriage return
the numerical point format. The result is returned in the return value of the function, returns a pointer to a string.
8. byte processing functions
The socket address is multi-byte data and does not end with a null character, which is different from the string in C language. Linux provides two groups of functions to process multi-byte data. One group starts with B (byte) and is compatible with the BSD system. The other group starts with MEM (memory,
B (byte) and is compatible with the BSD system. The other group starts with MEM (memory, is a function provided by ansi c.Functions starting with B include:(1) void bzero (void * s, int N): sets the first n Bytes of the memory specified by parameter S to 0, which is usually used to clear the socket address 0.(2) void bcopy (const void * SRC, void * DEST, int
connections to the server$ Connection = socket_accept ($ socket );If ($ connection){Socket_write ($ connection, "you have connected to the socket.../n/R ");}?>
You should use your command prompt to run this example. The reason is that a server is generated, not a Web page. If you try to use a web browser to run this script, it is likely to exceed 30 seconds. You
receiver socket number in addition to the local socket number, so as to dynamically establish full correlation during the data sending and receiving process.
Instance
This instance uses the connection-oriented Client/Server mode. The process is as follows: 2.3:
Figure 2.3 connection-oriented application Flowchart
Server program:
/* File Name: streams. c */
# Include
# Include
# Define TRUE 1
/
)
Java Byte ranges from-127 to 128, while C, C ++, VB, and OC are 0-255.
So what I think of is the simplest and most common method, so that I can avoid a lot of detours. What kind of high turn to low, the status turns to high, this doesn't work, it's called a cry (before I found this, I have learned a lot about it, and I will share it here .)
To put it bluntly: Before Android, I used javaee Java Web, so I was familiar with urldecoder. I tried to convert the URL encoding format !! Finally
cannot remove the comment, use the following code to load the extension library:
if (!extension_loaded (' Sockets ')){if (Strtoupper (substr (Php_os, 3)) = = = "WIN"){DL (' Php_sockets.dll ');}Else{DL (' sockets.so ');}}?>
If you don't know if your socket is open, you can use the Phpinfo () function to determine if the socket is open. You see if the socket is
-free. It uses datagram protocol UDP.(3) original socket (SOCK_RAW)The original socket allows direct access to the underlying protocol, such as IP or ICMP, and is powerful but inconvenient to use, mainly for the development of some protocols.
Socket creation and connection
The computer data store has two byte precedence: High byte priority and low byte priority.
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.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service