Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


winscok data fuckery

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
oib111
I post too much
Reputation: 0

Joined: 02 Apr 2007
Posts: 2947
Location: you wanna know why?

PostPosted: Sun Jul 06, 2008 9:55 pm    Post subject: winscok data fuckery Reply with quote

I making server/clinet applications and it's working fine. Just I'm getting this data fuckery whenever I receive and send stuff. Look...



My code for receiving and sending on the server and client is:

Code:

//SERVER
Result = recv(ClientSocket, recvbuf, DEFAULT_BUFLEN, NULL);
std::cout<<"Data recieved: "<<recvbuf<<"\n";
std::cout<<"Bytes recieved: "<<Result<<"\n";
std::cout<<"Sending back data...";
SendResult = send(ClientSocket, recvbuf, Result, NULL);
std::cout<<"\nData sent!\n";
std::cout<<"Data sent: "<<recvbuf<<"\n";
std::cout<<"Bytes sent: "<<SendResult<<"\n";


Code:

//CLIENT
SendResult = send(ConnectSocket, sendbuf, strlen(sendbuf), NULL);
std::cout<<"Data Sent: "<<sendbuf<<"\n";
std::cout<<"Bytes Sent: "<<SendResult<<"\n";
std::cout<<"Receiving data...";
Result = recv(ConnectSocket, recvbuf, DEFAULT_BUFLEN, NULL);
std::cout<<"\nData recieved: "<<recvbuf<<"\n";
std::cout<<"Bytes Recieved: "<<Result<<"\n";

_________________


8D wrote:

cigs dont make people high, which weed does, which causes them to do bad stuff. like killing
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
HalfPrime
Grandmaster Cheater
Reputation: 0

Joined: 12 Mar 2008
Posts: 532
Location: Right there...On your monitor

PostPosted: Sun Jul 06, 2008 10:11 pm    Post subject: Reply with quote

I dont think your buffer is receiveing a null terminator.
_________________
Back to top
View user's profile Send private message
oib111
I post too much
Reputation: 0

Joined: 02 Apr 2007
Posts: 2947
Location: you wanna know why?

PostPosted: Sun Jul 06, 2008 10:54 pm    Post subject: Reply with quote

That would cause a buffer overflow, but the outputted character wouldn't be the same all the time though right? And I changed it to receive with DEFAULT_BUFLEN+1 (handling the null character) but I still get the same error?
_________________


8D wrote:

cigs dont make people high, which weed does, which causes them to do bad stuff. like killing
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Sun Jul 06, 2008 11:24 pm    Post subject: Reply with quote

You aren't null terminating the buffer, just like HalfPrime said. Which causes that to happen. You can easily null terminate it as needed based on the return from recv:

Code:
Result = recv(ConnectSocket, recvbuf, DEFAULT_BUFLEN, NULL);


Then you would do, after that:

Code:
recvbuf[Result] = '\0';

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
nwongfeiying
Grandmaster Cheater
Reputation: 2

Joined: 25 Jun 2007
Posts: 695

PostPosted: Sun Jul 06, 2008 11:26 pm    Post subject: Reply with quote

I'm trying to do something similar and I got the concept, but haven't started yet. What do you plan on making?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites