I installed a x32 version 1.7.33 of Cygwin on my x64 Windows7 machine.

I added a new service under /etc/xinetd.d/ccapi.

$ cat ccapi-stream
service ccapi
        id = ccapi-stream
        disable = no
        socket_type = stream
        protocol = tcp
        wait = no
        user = alma
        server = /cygdrive/c/ccintegration/scripts/cygwin/server_xinet.exe
        port = 49300

I followed the xinetd-README to install xinetd and started it:

cygrunsrv -I xinetd -d "CYGWIN xinetd" -p /usr/sbin/xinetd -a "-stayalive -dontfork" -y tcpip -u alma -w xxx
cygrunsrv -S xinetd

Command "ps -ef" shows xinetd is running.

The server_xinet.exe is a compiled ActiveState perl script. It echoes what it receives from the client:

open($localLog ">> local.log");
$rdata = <STDIN>;
print $localLog "  Data Received at $d $t: <$rdata>\n";  # so I know xinetd loads this exe
close $localLog;

# write response data to the connected client
print STDOUT "You said: $rdata\n";

The client perl script just sends a string to port 49300.

$HOST = "";  # also tried using hostname "HOST.xxx.com";
$PORT = "49300";
$data = "@ARGV";

$socket = IO::Socket::INET->new(
    PeerAddr => "$HOST",
    PeerPort => "$PORT",
    Proto => "tcp",
die "Could not connect to $HOST:$PORT : $@\n" unless $socket;

  print $socket "$data\n";
  $answer = <$socket>;
  print "Echo from server: <$answer>\n";

I ran this client script on the same machine and it receives nothing from the server

$ perl simpleClient.pl "This is it:"
Echo from server: <>

I checked the local.log and finds a new entry in there:

Data Received at 2015mar12 10:11:39: <>

This means cygwin xinetd launches server_xinet.exe.

The problem is that the server reads nothing from <STDIN> and whatever it writes to <STDOUT>, the client did not receive it.

I ported this from a Unix machine and it works fine there.

What is the problem here in Cygwin?

Thanks for any help you can provide.


I finally got my client/server talking to each other. I decided to use cygwin perl to run both the server and client and it works. Instead of /cygdrive/c/ccintegration/scripts/cygwin/server_xinet.exe (compiled using ActiveState PDK) in /etc/xinetd.d/ccapi-stream, I replaced it with /cygdrive/c/ccintegration/scripts/cygwin/server_xinet.pl Then use '#!/usr/bin/perl' as the first line in both server_xinet.pl and simpleClient.pl.

./simpleClient.pl "This is working" Echo from server:

Regards, alma

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.