LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 06-01-2007, 03:08 AM   #1
rajat
LQ Newbie
 
Registered: Jan 2007
Posts: 20

Rep: Reputation: 0
Is there an alternate to while(1) loop in the TCP server ?


Hi Folks,

I have a TCP server ( I named it ikev2_socket_server ) on Linux FC6, kernel 2.6.18. It servers the clients on the Widows machine. This server waits in a while(1){} loop to clients to connect to it. Is there a way I can make this server wait for the client without waiting in the while(1){} loop?

Well the reason I am asking is:

I am trying to make this Server a service much like a dchpd service so that I can start/stop/check status of it. I have created a script ( named it segwd ) much like a /etc/init.d/dhcpd script and kept it in /etc/init.d directory. This script has the functionality to Start, Stop , Status and restart the server.

In the Start case, I m using the daemon command to make this tcp server a daemon. The syntax is
daemon ikev2_socket_server. Now the problem is :

As I do service segwd start, the script does not return. The reason i know is the while(1){} loop in th TCP server which waits for the clients to connect and itself does not return. Is there a way I can make my server wait for clients to connect without using the while(1){} loop?

Regards,
Rajat
 
Old 06-01-2007, 03:42 AM   #2
flupke
Member
 
Registered: Jun 2005
Location: BE
Posts: 30

Rep: Reputation: 15
Maybe you can start your service in the background by adding an '&' at the end of the lin that starts the server :
Code:
daemon ikev2_socket_server &
 
  


Reply



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
how to loop over text file lines within bash script for loop? johnpaulodonnell Linux - Newbie 9 07-28-2015 03:49 PM
no loop dev. after doing tasksel desktop / web server Funki Debian 2 12-15-2004 08:54 AM
is there any alternate to Xfree server....crashed twice??? satish427 Linux - Newbie 1 10-02-2004 12:26 AM
Mail Server Delimiter for alternate mail server venugopalmk Linux - Networking 2 04-29-2003 04:55 AM
TCP/IP server maxgor Programming 4 02-18-2003 02:37 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 07:33 AM.

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