a primary proj to test socket coding in Linux
- 新建套接字;
- 设置目标服务器的Port和IP Addr;
- 尝试连接服务器;
- 发送信息;
- 关闭套接字。
- 新建套接字;
- 设置套接字选项;
- 绑定自身的Port,和可以接受的IP Addr;
- 监听连接;
- 捕获连接;
- 接收套接字;
- 信息处理;
- 关闭套接字;
- 返回捕获连接这一步。
最终效果如下:
dzw@ubuntu:~/SocketTestProj$ ./server.out
wait for socket from any client...
Get one message from client:
port : 24236
IP Addr : 192.168.184.128
message : hello, server
Get one message from client:
port : 24748
IP Addr : 192.168.184.128
message : hello, server
...