|
我在我机子上运行程序没有任何问题。。可是放到其他机子上运行就出闲了:没有找到ACED.dll, 因此这个应用程序未能启动。
这是我的代码:
#ifdef _DEBUG
#pragma comment (lib,"aced.lib")
#else
#pragma comment (lib,"acesd.lib")
#endif
#include"iostream"
#include<string>
#include"fstream"
#include"ace/INET_Addr.h"
#include"ace/SOCK_Acceptor.h"
#include"ace/SOCK_Stream.h"
#include"ace/Time_Value.h"
#include <ace/Log_Msg.h>
using namespace std;
int ACE_TMAIN(int argc,ACE_TCHAR* argv[])
{
ACE_INET_Addr severAddr;
ACE_SOCK_Acceptor acceptor;
ACE_SOCK_Stream severStream;
int severPort=80;
if(severAddr.set(severPort)==-1)
{
ACE_DEBUG ((LM_DEBUG,ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("set failed")));
system("pause");
return 1;
}
if(acceptor.open(severAddr)==-1)
{
system("pause");
ACE_DEBUG ((LM_DEBUG,ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("open failend")));
return 1;
}
for(;;)
{
if(acceptor.accept(severStream)==-1)
{
ACE_DEBUG ((LM_DEBUG,ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("accept failed")));
system("pause");
return 1;
}
ACE_INET_Addr raddr;
severStream.get_remote_addr(raddr);
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("(%P|%t) connect:%s%d\n"),
raddr.get_host_addr(),
raddr.get_port_number()));
int *pX=0;
char BUFFER[1024];
memset(BUFFER,0,sizeof(BUFFER));
if(severStream.recv_n(BUFFER,sizeof(BUFFER))==-1)
{
ACE_DEBUG ((LM_DEBUG,ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("receive failed")));
system("pause");
return 1;
}
ofstream fout;
//string str;
//strcpy(&str[0],BUFFER);
fout.open("d://1.txt");
//fout<<BUFFER;
fout<<"123";
fout<<BUFFER;
memset(BUFFER,0,sizeof(BUFFER));
cout<<"输入字符串:"<<endl;
while(cin>>BUFFER)
{
if(strcmp(BUFFER,"q")==0)
return 0;
if(severStream.send_n(BUFFER,sizeof(BUFFER))==-1)
{
ACE_DEBUG ((LM_DEBUG,ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("send failed;")));
system("pause");
return 1;
}
}
}
return severStream.close()==-1?0:1;
}
并且也设置了静态链接库。用的release版本 |
|