|
我刚用 VS2005 编译了ACE5.5,成生了ace.dll aced.dll 和ace.lib aced.lib等,并用这些写了简单的测试程序,运行通过了;
但当我将编译通过的SimpleServer.exe 和aced.dll部署到另外一台机器上运行时却爆出以下错误,不知是何问题
d:\SimpleServer.exe
由于应用程序配置不正确,应用程序未能启动。重新安装应用程序可能会纠正这个问题。
本人开发环境为:ACE5.5 + vs2005 + windows 2003 server
SimpleServer 的代码如下:- #include "ace/INET_Addr.h"
- #include "ace/SOCK_Stream.h"
- #include "ace/SOCK_Acceptor.h"
- #include "ace/Log_Msg.h"
- #include "ace/OS_NS_sys_time.h" // for ACE_Time_Value
- #define MAXHOSTNAMELEN 50
- int ACE_TMAIN (int, ACE_TCHAR *[])
- {
- ACE_INET_Addr port_to_listen (50000, ACE_LOCALHOST);
- ACE_SOCK_Acceptor acceptor;
- if (acceptor.open (port_to_listen, 1) == -1)
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("%p\n"),
- ACE_TEXT ("acceptor.open")),
- 100);
- /*
- * The complete open signature:
- *
- int open (const ACE_Addr &local_sap,
- int reuse_addr = 0,
- int protocol_family = PF_INET,
- int backlog = ACE_DEFAULT_BACKLOG,
- int protocol = 0);
- *
- */
- while (1)
- {
- ACE_SOCK_Stream peer;
- ACE_INET_Addr peer_addr;
- ACE_Time_Value timeout (10, 0);
- /*
- /* Basic acceptor usage
- /*/
- #if 0
- if (acceptor.accept (peer) == -1)
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("(%P|%t) Failed to accept ")
- ACE_TEXT ("client connection\n")),
- 100);
- else
- {
- ACE_TCHAR peer_name[MAXHOSTNAMELEN];
- peer_addr.addr_to_string (peer_name, MAXHOSTNAMELEN);
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("(%P|%t) Connection from %s\n"),
- peer_name));
- char buffer[4096];
- ssize_t bytes_received;
- while ((bytes_received =
- peer.recv (buffer, sizeof(buffer))) != -1)
- {
- peer.send_n (buffer, bytes_received);
- }
- peer.close ();
- }
- #endif /* 0 */
- if (acceptor.accept (peer, &peer_addr, &timeout, 0) == -1)
- {
- if (ACE_OS::last_error() == EINTR)
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("(%P|%t) Interrupted while ")
- ACE_TEXT ("waiting for connection\n")));
- else
- if (ACE_OS::last_error() == ETIMEDOUT)
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("(%P|%t) Timeout while ")
- ACE_TEXT ("waiting for connection\n")));
- }
- else
- {
- ACE_TCHAR peer_name[MAXHOSTNAMELEN];
- peer_addr.addr_to_string (peer_name, MAXHOSTNAMELEN);
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("(%P|%t) Connection from %s\n"),
- peer_name));
- char buffer[4096];
- ssize_t bytes_received;
- while ((bytes_received =
- peer.recv (buffer, sizeof(buffer))) != -1)
- {
- peer.send_n (buffer, bytes_received);
- }
- peer.close ();
- }
- }
- return (0);
- }
复制代码 望高手指教,在线等。。。 |
|