I. OverviewTask Description:Develop a program to obtain the list of Host IP addresses that enable the snmp service in the LAN, and write the corresponding files for other programs to use.Background:SNMP is based on UDP, and the standard SNMP Service uses ports 161 and 162.Ideas:1. Obtain the list of local online hosts;2. Obtain the enabled snmp port (such as 161) of each host;3. Write a specific file in a s
coding point of view is as follows: TCP communication requires server-side listening Listen, receiving client connection request accept, waiting for client connect to establish a connection before sending and receiving packets (recv/send). However, the concept of UDP server and client is not obvious, the server side is the receiving end need to bind the port, w
The current operating system basically implements the TCP/IP protocol. The TCP/IP protocol stack is divided into five layers:
Application Layer: A group of common applications provided to users, such as telnet, FTP, SMTP, SNTP, DNS, and HTTP, which have a port to identify.
Transport Layer: The main protocols are TCP an
Python: tcp and udp network programming example of SocketServer
Example of a tcp network program written using the SocketServer module (socketserver in python3:
#! /Usr/bin/env python
# Server
From SocketServer import TCPServer as TCP, StreamRequestHandler as SRH
Class MyRequestHandler (SRH ):Def handle (self ):Print
the request
(3) Close the communication channel and terminate after the request is completed
5. Type of socket socket
(1) streaming socket (SOCK_STREAM)
Provide connection-oriented, reliable data transfer service, no error, no duplication, and receive in Send Order (TCP protocol)
(2) Datagram Socket (SOCK_DGRAM)
Provides connectionless services, packets are sent in separate packages, no flawless warranties, data may be lost, and receive order confus
a sack packet length of 2, no content part8 means timestamp, length 10, timestamp with 8 bytes */typedef struct _TCP_OPTIONS {Char M_ckind;Char m_clength;Char m_ccontext[32];}__ATTRIBUTE__ ((Packed)) tcp_options, *ptcp_options;Iv. definition of UDP header structure/*UDP header definition, total 8 bytes */typedef struct _UDP_HEADER {unsigned short m_ussourport; Source P
What are common TCP ports?
FTP: defines the file transfer protocol. Port 21 is used. It is often said that a certain host has enabled the FTP service, which is the file transfer service. You must use the FTP service to download files and upload them to the home page.
TELNET: Are you on BBS? In the past, BBS was a character-only interface. The server supporting BBS opened
mf=0 represents the current datagram as the last datagram. The sub-low is df,df=1, the Df=0 representative can be fragmented. (3) Slice offset (Fragment offset), 13 bits; represents the relative position of a shard in the original data.
3, third four bytes:(1) Time-to-live (TTL), 8-bit, which previously represented the maximum lifetime of an IP datagram, now identifies the number of routers that IP datagrams can pass through. (2) protocol (PROTOCOL), 8-bit, representing the type of the upper la
=af_inet;Sockaddr.sin_port=htons (6000);3. Sockets and IP addresses and port connectionsConnect (sockclient, (sockaddr*) sockaddr,sizeof (sockaddr));4. Send and receive data to the serverChar recvbuf[100];Recv (sockclient,recvbuf,100,0);printf ("%s\n", recvbuf);Send (sockclient, "Hello Server", strlen ("Server Hello") +1,0);5. Close the socketClosesocket (sockclient);WSACleanup ();Don't forget to add the header file #includeUdpUDP is a non-connected,
0.PCATTCP Introduction
PCATTCP's predecessor, Test Tcp,test TCP, is the native tool of the BSD operating system, which uses the console input parameters to test TCP or UDP communication speed. The project was launched in 1984 and the source code for the tool is now open. PCATTCP is the Windows ported version of test
"media-Open Network streaming" and enter"UDP: // @ 1234"Click play.
Interface operations are relatively simple, but scripts are reliable if such operations are often performed.
Command Line Operation Method
Server (172.16.1.1):
VLC-vvv sample1.avi -- sout UDP:172.16.1.100:1234-- TTL10
Client (172.16.1.100):
Vlc udp://@: 1234
2
,
RTP
Method
This article is made available by checking information on the network.
You only need to modify it to use it in the project.
Reference for children's shoes
Platform (lm3s9b92 + ucoⅱ + LWIP)
Online IP address converter (Binary hexadecimal conversion)
Http://www.ab126.com/goju/1840.html
Implemented under the LWIP netconn API Function
TCP Server
Tcp client
UDP Tes
0.PCATTCP Introduction
The predecessor of PCATTCP is Test tcp,test TCP is the native tool of the BSD operating system, which is used to test TCP or UDP communication speed through console input parameters. The project was launched in 1984 and the source code for the tool is now open. PCATTCP is the Windows porting vers
:(The initialization of Winsock: WSAStartup)//windows SpecialServer side:Socket: Setting up socketsBind: Publish port (Netstat-an visible Port already published)Sendto/recv/recvfrom: Sending and receiving dataClient side:Socket: Setting up socketsBind: Publish port (Netstat-an visible Port already published)Sendto/recv
Socket programming (UDP TCP) code memo C++/C
Sockets (socket) programming has three kinds, streaming socket (sock_stream), datagram Socket (SOCK_DGRAM), the original socket (SOCK_RAW); Socket programming based on TCP is a streaming socket (sock_stream). Datagram Sockets (SOCK_DGRAM) based on UDP.Programming steps for 1.TCP
Differences Between TCP and UDP: TCP is a connection-oriented, reliable, and byte stream-based Transport layer. UDP (User Datagram Protocol): It is a connectionless transport layer protocol in the OSI reference model. It provides a simple and unreliable information transmission service for transactions. ietf rfc 768 is
Http://www.codewalkers.com/c/a/Miscellaneous-Code/PHP-TCP-UDP-Network-Client-Class-w-Example/----------------------------------------Include ('class. tcpclient. php ');
// ** Displays the error message given if there is non-empty text.
Function showerror ($ errortext){If (strlen ($ errortext)> 0)Print ("}// ** The POP server address, user account, and password to use// ** Testing client application. Note: Y
• Socket facilitates applications to access the communication protocol TCP/IP.• Socket is the end point of the communication link. We can think of socket as a telephone. With Socket, we have a communication tool. We can think of the IP address as the phone number and the port number as the extension number.1. TCP-based socket programming.• Java.net. ServerSocket
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.