in reply to Re: local webserver for CGI on linux
in thread local webserver for CGI on linux
and#!/usr/bin/perl -w use strict; # simple server use Socket; use IO::Handle; socket(SERV, PF_UNIX, SOCK_STREAM,0); unlink "/tmp/testsock"; bind(SERV,sockaddr_un("/tmp/testsock")) or print "ERROR!"; listen(SERV,1); while (accept(CLIENT,SERV)) { CLIENT->autoflush(1); print CLIENT "Hi there!\n"; my $answer = <CLIENT>; print $answer; }
This works to the point where the server should recieve and print the answer from the client -- it doesn't. The initial "Hi there!" is recieved and printed tho. Once I can get back and forth communication working, I should be able to figure out what to do next.#!/usr/bin/perl -w use strict; # simple client use Socket; use IO::Handle; socket(TSOCK, PF_UNIX, SOCK_STREAM,0); connect(TSOCK, sockaddr_un("/tmp/testsock")) or print("ERROR!"); while (defined(my $messg = <TSOCK>)) { print $messg; print TSOCK "Hello server!"; TSOCK->flush; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: local webserver for CGI on linux
by chromatic (Archbishop) on Sep 19, 2008 at 21:59 UTC | |
|
Re^3: local webserver for CGI on linux
by Illuminatus (Curate) on Sep 19, 2008 at 18:45 UTC |