Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to create a socket as a child process?

Status
Not open for further replies.

wenge

Programmer
Oct 28, 2010
2
0
0
US
I wrote a Tcl socket script as server which will accept data from client and then pass to main Tcl script. My question is how to write main script to generate child process? Main script and socket server (child process) have to run on parallel.

Socket Server:

socket -server myServer port
vwait events

 
Code:
#client app
set s [socket localhost 8888]
puts $s "this is a test"
flush $s
close $s

Code:
#server app
proc srvTest {chan cadd cport} {
     puts [gets $chan]
     close $chan
}
socket -server srvTest 8888
vwait forever

is that what you're asking?

_________________
Bob Rashkin
 

Thanks, Bob.

I have no problem to write client and server programs. But I
have problem to write a main script to fork the server program
and keep main script to do other jobs and keep server to waiting for client request. The main script and sub-process have to be run on parallel.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top