开发者

Trying to reading from a socket for the first time fails, then it works fine

开发者 https://www.devze.com 2023-01-25 08:32 出处:网络
I\'m trying to set up a server.I intend to use firefox as a client. The idea is to wri开发者_运维技巧te down a certain path for a dir in your computer and the server to display the contents of that di

I'm trying to set up a server. I intend to use firefox as a client. The idea is to wri开发者_运维技巧te down a certain path for a dir in your computer and the server to display the contents of that dir.

I created the socket binded it etc. Everytime there is a connection the server reads the request from the socket and opens the appropriate directory.

The problem is the first time i right down the path i want firefox seems to be waiting the server for ever while from the server side it seems the server waits for something to be written to the port in order to read it. If i stop the firefox and refresh, everything would run smoothly.

Am i missing something?:/ If you need some coding to help you out, let me know


You're probably forgetting to accept(2) (or something like that) until the second request. Post some code.

0

精彩评论

暂无评论...
验证码 换一张
取 消