Network test

The Partridge Family were neither partridges nor a family. Discuss.
User avatar
npissoawsome
Posts: 114
Joined: June 8th, 2012, 3:01 pm

Re: Network test

Post by npissoawsome » October 7th, 2012, 4:44 pm

Where did you guys learn network programming? I'm interested in it, but can't find anything helpful :(

Lorth
Posts: 139
Joined: July 19th, 2012, 4:12 pm

Re: Network test

Post by Lorth » October 8th, 2012, 1:54 pm

As i am not so use to programming i read alot on these web pages.
the second one was given from LuX :D

http://www.directxtutorial.com/
http://www.win32developer.com/
http://msdn.microsoft.com/en-us/library/default.aspx

after alot of reading, then it's just try and error to get it working into the chili framework. My implament so far, is far far away from finished and working propertly. As my program starts to move in slowmotion when i get the client to acctually connect to the host :D

User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: Network test

Post by chili » October 8th, 2012, 3:03 pm

I bet it's moving slow motion because you're using blocking calls. Try researching async functions for sockets. You either need to use async calls or you need to use threads.
Chili

User avatar
npissoawsome
Posts: 114
Joined: June 8th, 2012, 3:01 pm

Re: Network test

Post by npissoawsome » October 8th, 2012, 6:03 pm

npissoawsome wrote:Where did you guys learn network programming? I'm interested in it, but can't find anything helpful :(
that second website is a god, thank you so much

Lorth
Posts: 139
Joined: July 19th, 2012, 4:12 pm

Re: Network test

Post by Lorth » October 8th, 2012, 6:50 pm

Yeah that is what i have used so far, just trying to get things working.

Goal is to learn this so good that i can acctually implant it into the game we are starting to do with you chili xD

atm i have made it in alot of voids in the framework but shall now try to divide it into classes that might make it better :P

can't wait for next lession, keep em comming chili xD

Lorth
Posts: 139
Joined: July 19th, 2012, 4:12 pm

Re: Network test

Post by Lorth » October 10th, 2012, 7:39 pm

I have also found this guide

http://www.codeproject.com/Articles/412 ... plus-and-W

i think it might be usefull but i dunno how to implant it into chilies framework :D

so far i have tryed to divide it into two different visual projects and tryed to make them found eachother instead of his way there everything is in one project, but so far they don't find eachother so i don't get any connection between them :/

Lorth
Posts: 139
Joined: July 19th, 2012, 4:12 pm

Re: Network test

Post by Lorth » October 28th, 2012, 2:26 am

Hey Guys!

Now i am back with some new questions about this amazing network programming... again ;P

I have finally made it so far that i got a client and a server talking with eachother. The big question now is, how do i get the server to get cordinates and reply them to the client, the problem is that i have followed alot and read alot of tutorials. But in all of them they have used the send() function for messages, like "Hello".

messages are great tought, but it's not fun intil i get it to work with cordinates, so i can make two objects move around.

The problem atm is that i have declared the package to an const size, as the send() function requiers this. But how do i then give a new position if the position changes, positions are hardly const right :S

I dunno how i can make an position of a object, into a const char, as the position always changes :S

so my program right now only sends the same number back and forth, and i don't know how to get it to change :/

User avatar
LuX
Posts: 1492
Joined: April 22nd, 2012, 12:33 pm
Location: Finland

Re: Network test

Post by LuX » October 28th, 2012, 8:54 am

What I did is divide the "package" into pre-defined bits, coding vise.... So that for example the first 3 characters of the package are the X position, next 3 numbers the Y position. Then when the client gets these values I use string to int function to convert the char string into an int, I think the function was "int x = atoi ( char_x_pos );" where char_x_pos is a char [3] with the first three letters of the package.
ʕ •ᴥ•ʔ

Anddos
Posts: 4
Joined: October 23rd, 2012, 5:03 am

Re: Network test

Post by Anddos » October 28th, 2012, 5:14 pm

if its UDP how would you calculate the players ping?, i thought that was only for TCP?

User avatar
npissoawsome
Posts: 114
Joined: June 8th, 2012, 3:01 pm

Re: Network test

Post by npissoawsome » October 28th, 2012, 9:21 pm

LuX wrote:What I did is divide the "package" into pre-defined bits, coding vise.... So that for example the first 3 characters of the package are the X position, next 3 numbers the Y position. Then when the client gets these values I use string to int function to convert the char string into an int, I think the function was "int x = atoi ( char_x_pos );" where char_x_pos is a char [3] with the first three letters of the package.
You know you're able to send structs right?

Post Reply