Hi,
I have server(TCP/IP) code written in c++ which uses CArchieve with windows sockets as mention here in msdn
http://msdn.microsoft.com/en-us/library/ya4826hx(v=vs.80).aspx[
^].
When i try to connect it using clients written in c++, it works fine.
But if i try to connect using c# client, it doesn't get connected.
In the server code i have CArchieve along with socket to listen to data from clients. Is there some way i can use c# client to send data ? server is using CArchieve class along with sockets. How can make a client in c# which send data same as CArchieve in MFC
[edit]
This is my c++ code for creating sockets
bool TestApp::CreateSockets()
{
CString ipaddress;
m_pSocket = new CSocketListen( this );
if( m_pSocket )
{
m_ServerName.TrimLeft();
m_ServerName.TrimRight();
if( inet_addr( m_ServerName ) == INADDR_NONE )
{
HOSTENT *pHost = gethostbyname( m_ServerName );
if( pHost )
ipaddress.Format("%d.%d.%d.%d", (unsigned char)pHost->h_addr_list[0][0],
(unsigned char)pHost->h_addr_list[0][1],
(unsigned char)pHost->h_addr_list[0][2],
(unsigned char)pHost->h_addr_list[0][3] );
else
m_SocketStatus = WSAGetLastError();
}
else
ipaddress.Format("%s", m_ServerName );
if( m_pSocket->Create(m_ServerPort, SOCK_STREAM, ipaddress) )
{
m_pSocket->Listen();
return true;
}
else
{
if( m_pSocket->Create( m_ServerPort, SOCK_STREAM, _T("127.0.0.1") ) )
{
m_pSocket->Listen();
return true;
}
else
{
m_SocketStatus = GetLastError();
return false;
}
}
}
else
{
MessageBoxMemory();
return false;
}
}
C# client code i used from this codeproject link
TCP/IP Chat Application Using C#[
^]
[/edit[