Help - can't get Sever/Client to talk over sockets
-
I'm trying to get a very basic Client-Sever app using sockets to communicate (Below are the code snipets). First I start the server, it connects to port 6001 and waits. The client starts up and connects and sends a string, the server accepts the connection and tries to read data into dwValue but I get nothing - they do not communicate after the connection, any ideas why ?? Thanks in advance !! ------------ Server Code: m_sockRecv = new CSocket; CString dwValue; CSocket sockSrv; sockSrv.Create(6001); sockSrv.Listen(); CSocket sockRecv; sockSrv.Accept(sockRecv); CSocketFile file(&sockRecv); CArchive arIn(&file, CArchive::load); CArchive arOut(&file, CArchive::store); arIn >> dwValue; Client Code: CString str = "9"; csocket.Create(); csocket.Connect("localhost",6001); CSocketFile file(&csocket); CArchive arIn(&file,CArchive::load); CArchive arOut(&file,CArchive::store); arOut << str;