Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > C/C++
You last visited: Today at 12:04

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Crash in Thread (Recv)

Discussion on Crash in Thread (Recv) within the C/C++ forum part of the Coders Den category.

Reply
 
Old   #1
 
Terrat's Avatar
 
elite*gold: 130
Join Date: Apr 2012
Posts: 1,173
Received Thanks: 670
Crash in Thread (Recv)

Hey ho,
arbeite derzeit an einen Server Projekt, 1 Client kann der Server wunderbar managen und Threade ihn jetzt damit er halte Multiclient fähig ist. Habe die Recv funktion in einen Thread getan doch leider crasht es jetzt. (abort()) !Wen ich es ohne Thread mache crasht es nicht!

Code:
std::vector <Client> CMover;
Code:
void   Client::T_Recv(){
	while (true)
	{ 
		if (T_RecvR == 1)
		{ 
			char Buffer[5];
			long test;
			_cout << "Socket:" << GetSocket() << _endl;
			test=recv(GetSocket(), Buffer, 4, 0); //<- Hard coded ;D
			std::cout << Buffer;//<- Hard coded ;D
		}
		Sleep(0);
	}
}
Code:
void BootCMoverThread(int i) {
	CMover[i].T_Recv();
}
Call
Code:
std::thread t_thread(BootCMoverThread, PosInV);
Terrat is offline  
Old 12/05/2014, 21:21   #2

 
snow's Avatar
 
elite*gold: 724
Join Date: Mar 2011
Posts: 10,480
Received Thanks: 3,319
Code:
int &i
Code:
std::thread t_thread(BootCMoverThread, PosInV);
Mutig.
Schon mal versucht, i als Value und nicht als Referenz zu übergeben?
snow is offline  
Old 12/05/2014, 22:12   #3
 
Terrat's Avatar
 
elite*gold: 130
Join Date: Apr 2012
Posts: 1,173
Received Thanks: 670
Quote:
Originally Posted by snow View Post
Code:
int &i
Code:
std::thread t_thread(BootCMoverThread, PosInV);
Mutig.
Schon mal versucht, i als Value und nicht als Referenz zu übergeben?
War ein Tipp Fehler hatte das vorhin wo ich unterwegs war per Handy abgetippt. Ist aber halt "immernoch" obwohl es ja "vorher" ist ;D
Debug:


Terrat is offline  
Old 12/06/2014, 11:40   #4

 
Delinquenz's Avatar
 
elite*gold: 0
Join Date: Jan 2009
Posts: 1,160
Received Thanks: 232
Du kannst den std::thread doch nicht am Ende der Scope zerstören lassen, ohne ihn mit std::thread::detach() zu detachen oder auf ihn mit std::thread::join() zu warten.
Delinquenz is offline  
Reply


Similar Threads Similar Threads
[help] recv
08/02/2009 - Kal Online - 3 Replies
Soo, man man behinderter tag. naja wayne. bin grad dabei mich etwas mehr mit den recv packets außeinander zu setzen. unter anderem mit den zahlen dahinter. Borsti sagte das ist die größe (size) naja also ich hab mir das mal als hex ausgeben lassen (das packet für empfangene nachrichten im chat ) ich hab mir das folgendermaßen "notiziert" 0c 00 3c //size 44 65 6e 4a 61 73//name
[Question] Hooking send() & recv() works, but recv hiding data for co???
05/06/2009 - CO2 Programming - 2 Replies
Hey guys, I've been making a DLL to allow another program to intercept the packets of conquer using windows pipes. (Then its the job of the main program to decrypt the packets, the DLL only gives a communication channel for the main program) (winsock functions btw) - hooking send() works fine for my internet browser - hooking recv() works fine for my internet browser - hooking send() works fine for conquer online



All times are GMT +2. The time now is 12:04.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.