Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 10-02-2003, 09:19 AM   #1
Registered: Aug 2003
Location: Turkey
Posts: 88

Rep: Reputation: 15
Lightbulb Socket Programming

I read the guide about "Beej's Guide to Network Programming Using Internet Sockets"
I simply compiled the client and server programs and ran them. But there is a fact that the server waits to be connected and the client waits to be answered. Isn't that possible to implement the TCP/IP connection without waiting? I mean in a program which is supposed not to wait (a looping program) , can I implement the tcp/ip protocol with disabling that waiting action?And how?
Old 10-02-2003, 11:41 AM   #2
LQ Newbie
Registered: Feb 2003
Location: Horsham, PA
Posts: 28

Rep: Reputation: 15
Correct me if my anser seems as if I misunderstood your question. I also read Beej's guide, and went on to do a lot of windows socket programming. I remember a little bit about that example at the end. The server MUST. If the server doesn't loop, then it will not answer any sockets that enter it's que. One thing you can do though is to put the server loop in it's own thread, that way the program doesn't seem as if it's hanging. As far as the client goes, you kida-sorta have to wait. If the server is busy and takes a few milliseconds over average to respond, the client will drop if no waiting action is implemented. The reason that waiting is implemented is for 2 reasons: (1) as far as the server goes, it doesn't know when connections are going to come in, so it doesn't know when to check. Solution: check it all the time! thus the looping; (2) when a client makes a request, the server WILL NOT respond that instant, so you need to implement SOMETHING that will allow the server a few milliseconds (or if it's really lagging, start counting in seconds) of time to do it's processing and respond. I hope this helped.
Old 10-06-2003, 12:15 AM   #3
Registered: Aug 2003
Location: Turkey
Posts: 88

Original Poster
Rep: Reputation: 15
thank you for answering,
I contacted with Beej and solved the problem. select() command is the cure. Check it out its very useful...


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help me ... about Socket programming.. rajsun Programming 2 04-24-2005 04:50 PM
socket programming???? harbir Linux - Networking 2 07-05-2004 02:52 AM
want help in socket programming valib4u *BSD 2 09-11-2003 11:17 PM
Socket Programming cxel91a Programming 4 03-19-2003 10:05 AM
socket programming herambshembekar Programming 3 04-13-2002 03:13 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:34 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration