读书人

请教一个关于socket编程的有关问题函

发布时间: 2012-06-13 12:30:18 作者: rapoo

请问一个关于socket编程的问题,函数:connect
函数:connect(sockfd, (struct sockaddr*)&servaddr, sizeof(servaddr)),在这个函数中的第一个参数sockfd明明是采用的传值而不是传指针也不是别名,为什么当连接成功后,sockfd的值会变??

[解决办法]
gdb:
watch sockfd

VC6:
From the Edit menu, click Breakpoints.
Click the Data tab of the Breakpoints dialog box.
In the Expression text box, type the name of the variable:sockfd
Click OK to set the breakpoint.

读书人网 >C语言

热点推荐