Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Is this possible

Reply
Thread Tools

Is this possible

 
 
Theo James
Guest
Posts: n/a
 
      09-13-2004
I am a newbie perl programmer and I have an idea for a perl program,
but I want to know if it is possible before I attempt to write it.
Here is what I need:

I have a client, talking to my server via TCP/IP to port 1234. The
client is creating many seperate conversations that are a simple
request/response pairing. All requests from the client go to port
1234. Here is how I would like it to flow:

(main loop)
Server.pl accepts connection on port 1234 ->
locks port 1234 from any other new connection ->
redirects conversation to lesser know port (ex. 2345) ->
calls subserver.pl on port 2345 to handle request response
conversation

as soon as Server.pl fires off subserver.pl ->
unblock port 1234 and allow another connection (main loop)->

subserver.pl handles all communications with client and upon
completion (or time out) imports Server.pl that port 2345 is avilabile
for communication and then dies (or optionally wait for Server.pl to
send another session to it).


I already know how to handle this conversation without multiple
threads. Everything I've read out there seems to tell me that this is
hard or impossible. Can this be done? If so, is this design the best
what to handle it? If so, can you give me the main functions I should
look into? If not, can you point me in a different direction (please,
not C!!!)

Any help would greatly be appreicated!

--Theo James
 
Reply With Quote
 
 
 
 
Joe Smith
Guest
Posts: n/a
 
      09-15-2004
Theo James wrote:

> (main loop)
> Server.pl accepts connection on port 1234 ->


Server opens a socket on port 1234.
(main loop)
Server accepts incoming connection.

> locks port 1234 from any other new connection ->


Not needed.

> redirects conversation to lesser know port (ex. 2345) ->
> calls subserver.pl on port 2345 to handle request response
> conversation
> as soon as Server.pl fires off subserver.pl ->
> unblock port 1234 and allow another connection (main loop)->


Server decides on a suitable port, forks a child to listen
on that port. If the child creation is successful, send
the port number back on the original socket and close the socket.
Go back to main loop.

> subserver.pl handles all communications with client and upon
> completion (or time out) imports Server.pl that port 2345 is avilabile
> for communication and then dies (or optionally wait for Server.pl to
> send another session to it).


Server uses $SIG{CHILD} and wait() to determine which fork has
terminated.

> Can this be done?


Yes. After you've written a little bit of your servers and client,
if you have any concrete questions, post them to the comp.lang.perl.misc
newsgroup (not here at comp.lang.perl).
-Joe
 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
efficient data loading with Python, is that possible possible? igor.tatarinov@gmail.com Python 10 12-14-2007 04:44 PM
is it possible to possible to create an iterator from a callback interace? aninnymouse@gmail.com C Programming 4 02-21-2006 02:10 PM
XML + XSD: Is it possible to get all possible Values for an Element? Markus Java 1 11-22-2005 02:51 PM
Possible to connect 2 computers via USB? Michael Giroux Wireless Networking 2 09-02-2004 03:27 AM
Possible domain related wireless problem =?Utf-8?B?QWxpIEQ=?= Wireless Networking 0 08-10-2004 01:59 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57