文件名称:src
- 所属分类:
- Internet/网络编程
- 资源属性:
- [C/C++] [源码]
- 上传时间:
- 2015-11-22
- 文件大小:
- 3kb
- 下载次数:
- 0次
- 提 供 者:
- 刘*
- 相关连接:
- 无
- 下载说明:
- 别用迅雷下载,失败请重下,重下不扣分!
下载
别用迅雷、360浏览器下载。
如迅雷强制弹出,可右键点击选“另存为”。
失败请重下,重下不扣分。
如迅雷强制弹出,可右键点击选“另存为”。
失败请重下,重下不扣分。
介绍说明--下载内容均来自于网络,请自行研究使用
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