1. 用getsockname获得。
For TCP/IP, if the port is specified as zero, the service provider assigns a unique port to the application with a value between 1024 and 5000. The application can use getsockname after calling bind to learn the address and the port that has been assigned to it.2. 这好像不行,除非你用setsockopt设置了keepalive选项。
For TCP/IP, if the port is specified as zero, the service provider assigns a unique port to the application with a value between 1024 and 5000. The application can use getsockname after calling bind to learn the address and the port that has been assigned to it.2. 这好像不行,除非你用setsockopt设置了keepalive选项。
解决方案 »
- 菜单命令的响应问题????
- 无法用sendto发送udp包
- 请教:如何在CFormView中窗体上改变背景,背景是插入的BMP图片或其他格式图片,谢
- 一个VC++6.0的问题
- 求 <<vc数据库系统开发实例导航>>附书源代码
- 怎么引用另一个类里的静态变量?
- 我想把诸于checkbox、button等控件设置成disabled,该怎办?
- ####### 第一次用VC写XML但不知道如何用引用msxml啊########
- 编译问题,不知错误在哪里,请各位指教
- sendmessage的问题!!!!
- 请高手指点一下做个人的主页背景图怎么上传上去。谢谢。
- TAPI, RAS高手请进:怎样建立RAS服务器,侦听客户连接?
二使用
int select (
int nfds,
fd_set FAR * readfds,
fd_set FAR * writefds,
fd_set FAR * exceptfds,
const struct timeval FAR * timeout
);进行检查
1. 楼主问的是bind时分配的端口号,他已经建立socket了。
2. select可以处理对方突然死机的情况吗?