Clarification for David's question - Have you create the console app with MFC options? MFC options mean In the preferences I set the option "Use MFC as a shared DLL". Is that you mean or some thing else? Alse the variable s is of type CSocket. Other than the above mentioned code I did not write any thing extra (Except declarations). l is a character array of size 20 and n is an int type. s,t are variables of type CSocket. For Mark: --------- I did not write any code related to MFC initialization. Please tell me what is that code to initialize MFC in a console based application. Also, Please mail me how to attach my code to a window in a console based application without that window to be displayed. I did not understand the statement "MFC socket classes need a window to process socket events". Did not understand means How to simulate that is thing I did not understand. Srikanth K
S
SrikanthVinayak Ram
@SrikanthVinayak Ram
Posts
-
Socket Programming -
Socket ProgrammingHi Jobin, I have created a simple example to simulate TCP using MFC CSocket. The purpose of the code is Server Listens at port number 6000. Once client gets connects to 6000, client sends a message to Server and the server should display the received message. The server code is running correctly in the Application generated by AppWizardExe (include windows sockets check box Yes)but not at console based program. The code is as follows s.Create (6000); s.Listen (); s.Accept (t); n = t.Receive ((void*)l,20); l[n] = 0; cout<