| | |
Error receiving message
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Jan 2008
Posts: 23
Reputation:
Solved Threads: 1
Hi guyz. I am making a client-server application uysing CAnsySocket. A little history may help you assist. I made the application and was working just okay but the problem was that two client app. could not connect to the server. It always crashed. A viable solution to that was making a multi threaded server. Now, i have set worker threads for accepting the connection (For listening it is using the main thread). Below is the accepting code:
the error is in line 9. The code is compiling just okay but when the client tries to connect the server crashes. Now, when i debug, it us taking me to line 9. Things to do with the parameters. I have trapped an error that i would expect if the client cannot locate the server but since that error is not popping, the server is listenning just okay, just the accepting part. Please assist me.
cpp Syntax (Toggle Plain Text)
OnAccept() { THREADPARAMS * pSocket; // THREADPARAMS is a structure defined in .h AfxBeginThread(AcceptFunc, pSocket); } UNIT AcceptFunc(LPARAM pParam) { THREADPARAMS * pSocket; pSocket->m_sServerSocket.Accept(m_sClientSocket); } //in my .h typedef struct THREADPARAMS { CMySocket m_sServerSocket, m_sClientSocket; }
the error is in line 9. The code is compiling just okay but when the client tries to connect the server crashes. Now, when i debug, it us taking me to line 9. Things to do with the parameters. I have trapped an error that i would expect if the client cannot locate the server but since that error is not popping, the server is listenning just okay, just the accepting part. Please assist me.
Last edited by WolfPack; Feb 18th, 2008 at 2:09 am. Reason: Corrected the Code tags. IF you use [CODE=cpp][/code] then you don't have to write line numbers in your code.
•
•
Join Date: Jan 2006
Posts: 12
Reputation:
Solved Threads: 1
C++ Syntax (Toggle Plain Text)
THREADPARAMS * pSocket; pSocket->m_sServerSocket.Accept(m_sClientSocket);
pSocket is not initialized. You need to assign a valid value first.
![]() |
Similar Threads
- subject: SerializationStream message from hp Imaging (Windows NT / 2000 / XP)
- Need help with system error!!! (Viruses, Spyware and other Nasties)
- Runtime Error Help PLEASE (JavaScript / DHTML / AJAX)
- HELP: Line 197 Runtime error (Java)
- Spybot Error during check (Viruses, Spyware and other Nasties)
- error message pops up every 5 seconds (Novell)
- Removed Hotbar but still receiving an error message (Viruses, Spyware and other Nasties)
- Error message: Mailbox Temporarily Full (OS X)
- Can't get mail past my Firewall (Windows NT / 2000 / XP)
- Internet Explorer script error (Web Browsers)
Other Threads in the C++ Forum
- Previous Thread: array in structures
- Next Thread: Socket programming in IPv6?
| Thread Tools | Search this Thread |
api array beginner binary bitmap c++ c/c++ calculator char char* class classes coding compile compiler console conversion count data database delete desktop developer directshow dll download dynamic email encryption error file forms fstream function functions game getline google graph gui homeworkhelper iamthwee ifstream input int integer java lib linkedlist linker linux loop looping loops map math matrix memory multiple news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference return rpg sorting string strings struct template templates test text text-file tree unix url vector video visualstudio win32 windows winsock word wordfrequency wxwidgets





