[Ace-users] Unable to run simple ACE programs in cygwin
ananthbv at gmail.com
Thu Jun 28 03:50:03 CDT 2007
I am running a simple client and server ACE programs on cygwin.
Compilation does not give any error. No error is shown at runtime
also, but it does not seem to run either. When I run the server, it
exits immediately. it does not block on 'accept' . 'echo $?' on the
shell shows return code as 128. Here are the things I tried:
1. 'ps -ef | grep <server / client>' does not show anything.
2. I ran make on the 'inserver' and 'inclient' programs in the
'examples' directory, ran the server and client, that also did not
give any result (and 'ps -ef' did not show any result here too).
3. I put in a couple of 'printf' at the beginning of 'main', this too
did not get printed at run-time. But commenting out all code except
the 'printf' worked.
Can someone please help?
I am compiling the code using this command:
g++ <server / client program name> -I/cygdrive/c/cygwin/ACE_wrappers/ /
ACE version is 5.5.9.
$ g++ --version
g++ (GCC) 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
$ uname -a
CYGWIN_NT-5.0 cpv2000 1.5.24(0.156/4/2) 2007-01-31 10:57 i686 Cygwin
Here are the programs:
int main (int, char * argv )
ACE_INET_Addr port_to_listen ("HAStatus");
if (acceptor.open (port_to_listen, 1) == -1)
ACE_ERROR ((LM_ERROR, "%p\n", "acceptor.open"));
return( 100 );
ACE_Time_Value timeout (10, 0);
if (acceptor.accept (peer, &peer_address, &timeout, 0)
if (ACE_OS::last_error() == EINTR)
ACE_DEBUG ((LM_DEBUG, "(%P|%t)
Interrupted while " "waiting for client connection\n"));
else if (ACE_OS::last_error() == ETIMEDOUT)
ACE_DEBUG ((LM_DEBUG, "(%P|%t) Timeout
while " "waiting for client connection\n"));
else if (peer_address.get_port_number() == 0)
ACE_DEBUG ((LM_DEBUG, "(%P|%t) Invalid address
else if (peer.get_handle () == ACE_INVALID_HANDLE)
ACE_ERROR ((LM_ERROR, "%p\n", "accept"));
while ((bytes_received = peer.recv (buffer,
sizeof(buffer)-1)) != -1)
buffer[bytes_received] = 0;
peer.send_n (buffer, bytes_received
int main (int argc, char *argv)
ACE_INET_Addr srvr (50000, ACE_LOCALHOST);
if (-1 == connector.connect (peer, srvr))
ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "connect"), 1);
peer.send_n ("uptime\n", 7);
bc = peer.recv (buf, sizeof(buf));
write (1, buf, bc);
More information about the Ace-users