ok i have a program that is running gettin network/user data and i am adding a bit to it so it is a winsock server, i then have another program that is the client. basicall im just trying to get them to comunicate at the mo. here is the code:
so all im tryin to do is send data down, have it send it back..
any help???
regards
Dal
####################
# #
# Darren@DGoulston.com #
###################
Code:
//SERVER:
BOOL Create_Socket()
{
CString dwValue = "Server";
CAsyncSocket *sockSrvr;
int nPort = 25;
sockSrvr->Create(nPort,SOCK_DGRAM);
sockSrvr->Bind(nPort);
sockSrvr->Listen();
// construct a new, empty socket
CAsyncSocket sockRecv;
// accept connection
sockSrvr->Accept(sockRecv))
TCHAR buff[4096];
int nRead;
nRead = sockSrvr->Receive(buff, 4096);
CString CSbuff;
CSbuff = buff;
if (sockSrvr->Send(CSbuff,CSbuff.GetLength()))
{
return TRUE;
}
return TRUE;
}
Code:
//Client:
CString change_code(CString rep_str)
{
CString dwValue = "Client";
CString strAddr;
int nPort = 25;
strAddr = "10.0.11.29";
CSocket sockClient;
sockClient.Create();
// seek a connection
sockClient.Connect((LPCTSTR)strAddr, nPort);
TCHAR buff[4096];
int nRead;
if (sockClient.Send(dwValue,dwValue.GetLength()))
{
nRead = sockClient.Receive(buff, 4096);
}
return dwValue;
}
so all im tryin to do is send data down, have it send it back..
any help???
regards
Dal
####################
# #
# Darren@DGoulston.com #
###################