“选择”在 C 插座中
抱歉,如果我的问题很微不足道。
我在服务器程序中使用 select() 来查找新连接以及现有连接上的数据。但是,当我在一个连接/套接字上获取数据时,我的程序会读取数据并将其存储在一个数组中。这里,服务器不会回复客户端[尽管客户端处于recv()模式]。现在,当服务器返回到 select() 调用时,它就卡在那里了。不知道为什么。我的意图是,服务器应该从 select [ if no data ] 中出来。我也在 select() 上保留了超时。
在这方面的任何建议都会有很大的帮助。
Sorry if my question is trivial.
I am using select() in my server program to look for new connections as well as for data on exisitng connections. However, when I get data on one connection/socket, my program reads the data and store it, in an array. Here, The server will not reply back to client [ though client is in recv() mode ] . Now, when server goes back to select() call, it is getting stuck there. Not sure why. My intention is that, server should come out of select [ if there is no data ]. I kept timeout on the select() as well.
Any suggestions in this regards, would be of great help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我解决了。看来超时之前工作得不好。我已经修好了。现在工作正常。感谢大家。如果我有任何疑问,我会回复你们。
I got it resolved. Seems the timeout was not working fine earlier. I have fixed it. It is working fine now. Thanks to all. If i have any doubts, will ping back you all.