文件名称:src
-
所属分类:
- 标签属性:
- 上传时间:2015-11-22
-
文件大小:3.05kb
-
已下载:0次
-
提 供 者:
-
相关连接:无下载说明:别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容来自于网络,使用问题请自行百度
a.确定本机的IP和端口,socket只有与某一IP和端口绑定,才能发挥其功能。
b.确定通讯协议:TCP 或 UDP。
编程步骤:
a.建立一个套接字
b.绑定本机的IP和端口
c.如果是TCP,因为是面向连接的,要利用Listen()方法来监听网络上是否有人给自己发东西 如果是UDP,因为是无连接的,所以来者不拒。
d.TCP情况下,如果监听到一个连接,就可以使用accept来接收这个连接,然后就可以利用Send/Receive来执行操作了。而UDP,则不需要accept,直接使用SendTo/ReceiveFrom来执行操作。(注意,因为UDP不需要建立连接,所以在发送前并不知道对方的IP和端口,因此需要指定一个发送的节点才能进行正常的发送和接收)
e.不继续发送和接收时使用close。-a. determine the machine s IP and port, socket only with an IP and port binding, in order to function.
. b determine protocols: TCP or UDP.
Programming steps:
a. to establish a socket
b. Bind the machine IP and port
. c If TCP, because it is connection-oriented, and to take advantage of Listen () method to listen if anyone on the network to send their own thing if it is UDP, because it is not connected, so all comers.
Under d.TCP case, if listening to a connection, you can use the accept to accept the connection, then you can use the Send/Receive to perform the operation. The UDP, you do not need accept, directly SendTo/ReceiveFrom to perform the operation. (Note that because UDP does not need to establish a connection, so before sending did not know each other s IP and port, so you need to specify a sending node can perform normal transmission and reception)
e. not to continue sending and receiving using close.
b.确定通讯协议:TCP 或 UDP。
编程步骤:
a.建立一个套接字
b.绑定本机的IP和端口
c.如果是TCP,因为是面向连接的,要利用Listen()方法来监听网络上是否有人给自己发东西 如果是UDP,因为是无连接的,所以来者不拒。
d.TCP情况下,如果监听到一个连接,就可以使用accept来接收这个连接,然后就可以利用Send/Receive来执行操作了。而UDP,则不需要accept,直接使用SendTo/ReceiveFrom来执行操作。(注意,因为UDP不需要建立连接,所以在发送前并不知道对方的IP和端口,因此需要指定一个发送的节点才能进行正常的发送和接收)
e.不继续发送和接收时使用close。-a. determine the machine s IP and port, socket only with an IP and port binding, in order to function.
. b determine protocols: TCP or UDP.
Programming steps:
a. to establish a socket
b. Bind the machine IP and port
. c If TCP, because it is connection-oriented, and to take advantage of Listen () method to listen if anyone on the network to send their own thing if it is UDP, because it is not connected, so all comers.
Under d.TCP case, if listening to a connection, you can use the accept to accept the connection, then you can use the Send/Receive to perform the operation. The UDP, you do not need accept, directly SendTo/ReceiveFrom to perform the operation. (Note that because UDP does not need to establish a connection, so before sending did not know each other s IP and port, so you need to specify a sending node can perform normal transmission and reception)
e. not to continue sending and receiving using close.
(系统自动生成,下载前可以参看下载内容)
下载文件列表
socket.c
socket.h
main.c
socket.h
main.c
本网站为编程资源及源代码搜集、介绍的搜索网站,版权归原作者所有! 粤ICP备11031372号
1999-2046 搜珍网 All Rights Reserved.