RE: where to place a server
- Posted by Kat <gertie at PELL.NET> May 06, 2001
- 490 views
On 6 May 2001, at 17:48, sephiroth _ wrote: > Robert Craig wrote: > > Wouldn't multiple server *processes* do the job > > in most cases? Each process could create its > > i suppose so. you could just fork() and go back to listening for > connections, i guess. Don't even need to do that. Like Rob said, if we could async with winsock and get events triggered from it or the wininet.dll, handling the net would be as easy as in mirc. The following is a snip of mirc code: <mirc code> on 1:SOCKREAD:Newsspider*: { if ( %Newsspidercom.accept == yes ) { :nextread sockread -f %Newsspider.temp aline -p @ [ $+ [ $sockname ] ] %Newsspider.temp .timer. [ $+ [ $sockname ] ] 1 20 if ( $!line( @ [ $+ [ $sockname ] ] ,0) < 3 ) { /window -c @ [ $+ [ $sockname ] ] } ) { if ( %newspider.wrotewindow. [ $+ [ %sockname ] ] == $null ) { /window -c @ [ $+ [ %sockname ] ] } } <snip> </mirc code> It is triggered on incoming data on any port wildmatching the name Newsspider* (i used index numbers, incremented per url), then munges the incoming data and sends it to the window of the same name. It doesn't matter how many such urls i have open on that port, when the event is triggered, the assigned name of that connection is available, and i tag the data by the name i assigned it. doesn't even matter if the data arrived mixed with data from another url, the event processes one url until no more data of that name on that port, then it ends, and get triggered by the next data (prolly from another url, with a different name). The timer has the same name, and is reset at each incoming data event, to test the specs of the window and close it if there isn't anything relavant to me in it. I wrote that mirc code before i heard of Eu, and it's run fine for years,,, i am having trouble porting it to Eu tho. Kat