基于c语言,网络编程,服务器接收客户端1的信息发送给客户端2
1个回答
展开全部
char
buff2[1024*10];
int
receiveLen;
/*调用accept函数,等待客户端的连接*/
client_fd=accept(sockfd,(struct
sockaddr
*)&client_sockaddr,&sin_size
/*调用recv函数接收客户端的请求*/
recvbytes=recv(client_fd,buf,BUFFER_SIZE,0)
typedef
int
(WINAPI
ICEPUB_TCPSENDANDRECEIVETEXT)(char
*sendBuff,
int
sendBuffLen,char
*recvBuff,int
recvMaxLen,char*
serverIP,int
serverPort);
ICEPUB_TCPSENDANDRECEIVETEXT
*icePub_tcpSendAndReceiveText
=
0;
HINSTANCE
hDLLDrv
=
LoadLibrary
("icePubDll.dll");
if(hDLLDrv)
{
icePub_tcpSendAndReceiveText=(ICEPUB_TCPSENDANDRECEIVETEXT
*)
GetProcAddress
(hDLLDrv,"icePub_tcpSendAndReceiveText");
}
if(icePub_tcpSendAndReceiveText)
receiveLen=icePub_tcpSendAndReceiveText(buf,recvbytes),buff2,1024*10,"192.168.1.2",8000);
if(hDLLDrv)
FreeLibrary(hDLLDrv);
AfxMessageBox
(buff2);
buff2[1024*10];
int
receiveLen;
/*调用accept函数,等待客户端的连接*/
client_fd=accept(sockfd,(struct
sockaddr
*)&client_sockaddr,&sin_size
/*调用recv函数接收客户端的请求*/
recvbytes=recv(client_fd,buf,BUFFER_SIZE,0)
typedef
int
(WINAPI
ICEPUB_TCPSENDANDRECEIVETEXT)(char
*sendBuff,
int
sendBuffLen,char
*recvBuff,int
recvMaxLen,char*
serverIP,int
serverPort);
ICEPUB_TCPSENDANDRECEIVETEXT
*icePub_tcpSendAndReceiveText
=
0;
HINSTANCE
hDLLDrv
=
LoadLibrary
("icePubDll.dll");
if(hDLLDrv)
{
icePub_tcpSendAndReceiveText=(ICEPUB_TCPSENDANDRECEIVETEXT
*)
GetProcAddress
(hDLLDrv,"icePub_tcpSendAndReceiveText");
}
if(icePub_tcpSendAndReceiveText)
receiveLen=icePub_tcpSendAndReceiveText(buf,recvbytes),buff2,1024*10,"192.168.1.2",8000);
if(hDLLDrv)
FreeLibrary(hDLLDrv);
AfxMessageBox
(buff2);
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询