Location:
Search - SOCK_DGRAM
Search list
Description: 在VC++工程下,通过UDP实现的网络通信,一个很简单的例子,帮助了解UDP通信
Platform: |
Size: 56919 |
Author: lijie |
Hits:
Description: CUdpSocket是为了简化发送,解析UDP 数据报所提供的一个基类。这个类封装了基于SOCK_DGRAM的大部分基本操作。这个类提供两种工作模式,一种是和实际处理UDP 数据报的功能紧耦合,这需要通过继承实现,同时设置workmode 为auto_receive(参见SetWorkdMode),另外一种是直接作为单独对象出现,此时用户需要使用Recv成员函数自己处理数据的接收。-CUdpSocket is to simplify this, the analytical data reported by the UDP with a base class. This type of packaging based SOCK_DGRAM the most basic operation. This provides two types of work, is a practical and UDP data processing function of tight coupling, it needs to achieve through inheritance, as set workmode auto_receive (see SetWorkdMode), the other is directly emerging as a separate object, users need to use this member function since Recv others receiving data processing.
Platform: |
Size: 129046 |
Author: 刘林超 |
Hits:
Description: CUdpSocket是为了简化发送,解析UDP 数据报所提供的一个基类。这个类封装了基于SOCK_DGRAM的大部分基本操作。这个类提供两种工作模式,一种是和实际处理UDP 数据报的功能紧耦合,这需要通过继承实现,同时设置workmode 为auto_receive(参见SetWorkdMode),另外一种是直接作为单独对象出现,此时用户需要使用Recv成员函数自己处理数据的接收。-CUdpSocket is to simplify this, the analytical data reported by the UDP with a base class. This type of packaging based SOCK_DGRAM the most basic operation. This provides two types of work, is a practical and UDP data processing function of tight coupling, it needs to achieve through inheritance, as set workmode auto_receive (see SetWorkdMode), the other is directly emerging as a separate object, users need to use this member function since Recv others receiving data processing.
Platform: |
Size: 129024 |
Author: 刘林超 |
Hits:
Description: 在VC++工程下,通过UDP实现的网络通信,一个很简单的例子,帮助了解UDP通信-In VC++ Works through UDP to achieve network communications, a very simple example to help understand the UDP communication
Platform: |
Size: 3838976 |
Author: lijie |
Hits:
Description: winsocket
//--- --- -----
// Initialize Winsock
WSAStartup(MAKEWORD(2,2), &wsaData)
//-----------------------------------------------
// Create a receiver socket to receive datagrams
RecvSocket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)
-winsocket //-----------------// Initialize Winsock WSAStartup (MAKEWORD (2,2),
Platform: |
Size: 1024 |
Author: czs |
Hits:
Description: Socket接口是TCP/IP网络的API,Socket接口定义了许多函数或例程,程序员可以用它们来开发TCP/IP网络上的应用程序。要学Internet上的TCP/IP网络编程,必须理解Socket接口。
Socket接口设计者最先是将接口放在Unix操作系统里面的。如果了解Unix系统的输入和输出的话,就很容易了解Socket了。网络的 Socket数据传输是一种特殊的I/O,Socket也是一种文件描述符。Socket也具有一个类似于打开文件的函数调用Socket(),该函数返 回一个整型的Socket描述符,随后的连接建立、数据传输等操作都是通过该Socket实现的。常用的Socket类型有两种:流式Socket (SOCK_STREAM)和数据报式Socket(SOCK_DGRAM)。流式是一种面向连接的Socket,针对于面向连接的TCP服务应用;数据 报式Socket是一种无连接的Socket,对应于无连接的UDP服务应用。-Socket interface is TCP/IP network API, Socket Interface defines a number of functions or routines, the programmer can use them to develop TCP/IP network applications. Study on the Internet want TCP/IP network programming, we must understand the Socket Interface.
Socket Interface Designer is the first interface on the Unix operating system inside. If you know Unix system input and output, then it is easy to understand the Socket. Socket data transmission network is a special kind of I/O, Socket is a file descriptor. Socket also has a similar function call to open the file of the Socket (), the function return an integer of Socket descriptor, then the connection set up, data transmission and other operations through the implementation of the Socket. Socket type commonly used in two ways: streaming Socket (SOCK_STREAM) and data reported type Socket (SOCK_DGRAM). Streaming is a connection-oriented Socket, for in the TCP connection-oriented service applications Datagram Socket t
Platform: |
Size: 1406976 |
Author: 陈威 |
Hits:
Description: 用VC++6.0的Sockets API实现一个聊天室程序.txt
VC++对网络编程的支持有socket支持,WinInet支持,MAPI和ISAPI支持等。其中,Windows Sockets API是TCP/IP网络环境里,也是Internet上进行开发最为通用的API。最早美国加州大学Berkeley分校在UNIX下为TCP/IP协议开发了一个API,这个API就是著名的Berkeley Socket接口(套接字)。在桌面操作系统进入Windows时代后,仍然继承了Socket方法。在TCP/IP网络通信环境下,Socket数据传输是一种特殊的I/O,它也相当于一种文件描述符,具有一个类似于打开文件的函数调用-socket()。可以这样理解:Socket实际上是一个通信端点,通过它,用户的Socket程序可以通过网络和其他的Socket应用程序通信。Socket存在于一个"通信域"(为描述一般的线程如何通过Socket进行通信而引入的一种抽象概念)里,并且与另一个域的Socket交换数据。Socket有三类。第一种是SOCK_STREAM(流式),提供面向连接的可靠的通信服务,比如telnet,http。第二种是SOCK_DGRAM(数据报),提供无连接不可靠的通信,比如UDP。第三种是SOCK_RAW(原始),主要用于协议的开发和测试,支持通信底层操作,比如对IP和ICMP的直接访问。
-VC++6.0 using the Sockets API procedures for the realization of a chat room. Txt
VC++ on the support network programming socket support, WinInet support, MAPI and ISAPI support. One, Windows Sockets API is TCP/IP network environment, but also for the development of Internet, the most common API. The first University of California, Berkeley campus in UNIX for the TCP/IP protocol has developed an API, the API is well-known Berkeley Socket interface (socket). Into the Windows desktop operating system in the era after the Socket method inherited. In the TCP/IP network communication environment, Socket data transmission is a special kind of I/O, it is equivalent to a file descriptor, open the file with a similar function call in-socket (). Can interpret it this way: Socket is a communication endpoint, through which users can program the Socket and other network applications of Socket Communications. Socket exist in a "communication domain" (as described in the general thread o
Platform: |
Size: 3072 |
Author: 李涛 |
Hits:
Description: sockets(套接字)编程有三种,流式套接字(SOCK_STREAM),数据报套接字 (SOCK_DGRAM),原始套接字(SOCK_RAW);基于TCP的socket编程是采用的流式套接字(SOCK_STREAM)。基于UDP采 用的数据报套接字(SOCK_DGRAM).-sockets (socket) programming there are three kinds of stream sockets (SOCK_STREAM), datagram sockets (SOCK_DGRAM), raw sockets (SOCK_RAW) based on TCP-socket programming is used in streaming socket the word (SOCK_STREAM). Based on UDP datagram sockets used in (SOCK_DGRAM).
Platform: |
Size: 1024 |
Author: sun |
Hits:
Description: A simple application that shows how to use sockets in Objective C
Platform: |
Size: 113664 |
Author: Leonid |
Hits:
Description: Socket接口设计者最先是将接口放在Unix操作系统里面的。如果了解Unix系统的输入和输出的话,就很容易了解Socket了。网络的 Socket数据传输是一种特殊的I/O,Socket也是一种文件描述符。Socket也具有一个类似于打开文件的函数调用Socket(),该函数返回一个整型的Socket描述符,随后的连接建立、数据传输等操作都是通过该Socket实现的。常用的Socket类型有两种:流式Socket (SOCK_STREAM)和数据报式Socket(SOCK_DGRAM)。流式是一种面向连接的Socket,针对于面向连接的TCP服务应用;数据报式Socket是一种无连接的Socket,对应于无连接的UDP服务应用。-Socket Interface designers is the first interface on the inside of the Unix operating system. If you know the input and output of the Unix system, it is easy to understand Socket. Network socket data transfer is a special I/O, the Socket is also a file descriptor. Socket also has a similar function to open the file to call the Socket (), the function returns an integer Socket descriptor, subsequent connection establishment, data transfer and other operations are implemented by the Socket. There are two commonly used types of Socket: streaming the Socket (SOCK_STREAM) and Datagram type Socket (SOCK_DGRAM). Streaming is a connection-oriented Socket, the Socket connection corresponds to the connectionless UDP application for Datagram Socket is a TCP connection-oriented service applications
Platform: |
Size: 535552 |
Author: feiying |
Hits:
Description:
1、首先需要定义的对象:
SOCKET ReceivingSocket //接收端的Socket
SOCKADDR_IN ReceiverAddr //接收端的地址信息
char ReceiveBuf[1024] //接收数据缓冲区大小
int BufLength //缓冲区长度
SOCKADDR_IN SenderAddr //发送数据端地址信息
int SenderAddrSize = sizeof(SenderAddr) //发送端地址信息的长度
2、启动WSA动态库:
WSAStartup(MAKEWORD(2,2),&wsd)
3、创建socket:
ReceivingSocket=socket(AF_INET,SOCK_DGRAM,IPPROTO_UDP)
4、初始化服务器地址及监听端口
ReceiverAddr.sin_family=AF_INET //家族
ReceiverAddr.sin_port=htons(9000) //设置端口号
ReceiverAddr.sin_addr.s_addr=htonl(INADDR_ANY) //地址
5、绑定端口
6、接收数据:
ReceivingSocket,//接收端Socket
ReceiveBuf,//接收端用来存储数据的缓冲区
BufLength,//缓冲区的大小
0,//接收的附加选项,设置为0即可
(SOCKADDR*)&SenderAddr,//发送端的Socket地址
&SenderAddrSize//发送端Socket地址的大小 )
7、关闭socket,关闭WSA,1, you first need to define the object: the SOCKET ReceivingSocket // the the receiving end Socket SOCKADDR_IN distant ReceiverAddr // the receiving end the address information char ReceiveBuf of [1024] / / receive data buffer size int BufLength // buffer length SOCKADDR_IN distant SenderAddr // send data end address information int SenderAddrSize = sizeof (SenderAddr) // length of the address information of the sender, start WSA dynamic library: the WSAStartup (MAKEWORD (2,2), & wsd) 3, create socket: ReceivingSocket = socket ( AF_INET, SOCK_DGRAM, IPPROTO_UDP) initialize server address and listen port ReceiverAddr.sin_family = AF_INET //family ReceiverAddr.sin_port = htons (9000) //set port number ReceiverAddr.sin_addr.s_addr = htonl (INADDR_ANY) //address 5, binding port 6 the the receiver Data: ReceivingSocket,// receiving end the the Socket ReceiveBuf,// receiving end is used to store data buffer BufLength// buffer size 0,//
Platform: |
Size: 5223424 |
Author: xiaoxiao |
Hits:
Description: 大多数程序员所接触到的套接字(Socket)为两类: (1)流式套接字(SOCK_STREAM):一种面向连接的Socket,针对于面向连接的TCP服务应用; (2)数据报式套接字(SOCK_DGRAM):一种无连接的Socket,对应于无连接的UDP服务应用。 从用户的角度来看,SOCK_STREAM、SOCK_DGRAM这两类套接字似乎的确涵盖了TCP/IP应用的全部,因为基于TCP/IP的应用,从 协议栈的层次上讲,在传输层的确只可能建立于TCP或UDP协议之上(图1),而SOCK_STREAM、SOCK_DGRAM又分别对应于TCP和 UDP,所以几乎所有的应用都可以用这两类套接字实现。-Most programmers have access to a socket (Socket) into two categories: (1) stream socket (SOCK_STREAM): a connection-oriented Socket, for applications in service-oriented TCP connections (2) Data News sockets (SOCK_DGRAM): a connectionless socket, corresponding to the UDP connectionless service applications. From the user s perspective, SOCK_STREAM, SOCK_DGRAM socket these two seem really covers all the TCP/IP applications, because TCP/IP-based application-level protocol stack speaking at the transport layer is indeed possible to build only on top of TCP or UDP protocol (Figure 1), and SOCK_STREAM, SOCK_DGRAM also correspond to the TCP and UDP, so almost all of the applications can be used to achieve these two sockets.
Platform: |
Size: 821248 |
Author: johnxi |
Hits:
Description: TCP/IP协议叫做传输控制/网际协议,又叫做网络通信协议。实际上,它包括上百个功能的协议。
套接字(socket):在网络中用来描述计算机中不同程序与其他计算程序的通信方式。
套接字分为三类;
流式socket(SOCK_STREAM):提供可靠,面向连接的通信流;它使用TCP协议,从而保证了数据传输的正确性和顺序性。
数据报socket(SOCK_DGRAM):数据报套接字定义了一种无连接的服务,数据通过相互独立的报文进行传输,无序的,并且不保证可靠,无差错的。它使用的数据报协议是UDP。
原始socket:原始套接字允许对底层协议如TP或ICMP进行直接访问,它功能强大但使用复杂,主要用于一些协议的开发。(Socket implementation of UDP communication)
Platform: |
Size: 1024 |
Author: LoenWolf |
Hits: