Quote:
Originally Posted by White&Black
it is posible to learn?becouse i understand 10% of that. I tought its easy but now i see that I need toread in google ;D
|
Yep you're able to learn a few months ago I was thinking like wth is all that network stuff:S I didn't understand anything about it how do you read such network thing and once you have that whole hex look-a-like packet how to make it readable how can i build my own packets how do I know what value it is and where it comes from.
Since i'm using C++ I read beej's guide. which is a great startup for beginners to understand some basics about how you can send stuff over the network. Be aware that you need to know how to use a programming language you can't just dive into that stuff cause it will drive you crazy:)
So after that tutorial I build a server app which could accept 1 user and send and receive a text(cause a string was the only way for that program I didn't had something like a packetwriter yet).
so once I got a little chat program I started to download some open source network servers and see how they wrote packets. This didn't really helped cause I didn't understand a thing about it. But then I found something on the net which explained how to convert something like a int into a array without convert it into a string.
This was done by the following line:
Code:
*(int*)&buffer[0] = value;
in this case the value is the value which i want to put in my char array which is called buffer. so now I got some code on how to write but now I wanted to read that value so how do I do that? well there was this line of code for
Code:
int value = *(int*)&buffer[0];
as y ou can see the operands are changed. *(operand is the part which is at the left or right of an operator. some has 1 operand some 2 and others might have 3 but that doesn't matter right now the equal sign has 2.)
so right now you're reading the value out of an char array which just converts 4 bytes (which is the size of an int) from the buffer to that variable.
owh and by the way the index of the array is the start position of the conversation.
oke well this might be a bit overwhelming and a little long to read but if you try to focus on creating some kind of chat program first and than start creating something like a packet reader and writer to pack data so you can send it all.
Owh I just remembered another method so stupid this one might be easier which is creating an structure and fill that structure and send it over the network so you don't have to pack it byte for byte but you define something like:
Code:
struct packet
{
int Id;
float someOtherData;
string Name;
}
so in this cause you have the whole packet in 1 struct. this might also be a bit tricky for the name but I won't go into that part for now.
I hope this helped a litte.
btw should I write some kind of tutorial on how to start with an emulator? just an simple basic thing so you have something to play arround with?