sucking potata

Started by
8 comments, last by wodinoneeye 10 years, 7 months ago


Advertisement

The Networking Forum FAQ has links to several good tutorials on the subject.

I have been searching for some information as well.

One thing you should definitely do is follow the instructions on the MSDN website on Winsock: LINK

Also, take a look at Beej's Networking Guide (or something similar). He gives a very nice explanation of every step in the Winsock setup. (Information on every function and what not).

I also made a blog post about networking if you wish to read it: BLOG

Regards,

Frostraver

Both Java and C# just put an abstraction layer over sockets, C# of course only cares about winsock being .net normally, while Java just abstracts over the different socket libraries depending on platform. Essentially you could do the same thing yourself in C++, or use a library that does it already.

The thing is, unlike a lot of other stuff sockets are very similar in both unix sockets and winsock, winsock is essentially just a windows implementation of the same sockets so the usage of both can be covered pretty well in tutorials. Unlike something like windowing where win32/winapi is rather different from xlib.

Winsock isn't terribly different from BSD sockets. You have to initialize it with and include a header, and close() becomes CloseSocket(), but apart from that they're almost identical.

void hurrrrrrrr() {__asm sub [ebp+4],5;}

There are ten kinds of people in this world: those who understand binary and those who don't.

http://zeromq.org/

Not sure if it can be any easier.

Since C++ is on a much lower level Socket programming makes use of sockets implemented for each Operating System

Although C++ makes it easier than Java or .NET to work directly with low level C code, generally there is no reason that you should.

However as Khatharr mentioned, the sockets API on most platforms is very similar (Mainly because Winsock was designed based on BSD sockets a long time ago).

This combined with the fact that using the sockets API directly isn't that difficult (i.e not too much boilerplate code required to get quick results) so I probably suggest wrapping your own socket library. I could give you a link to loads of premade socket libraries but personally I dislike using other peoples wrappers for this kind of thing.

Below is a list of simple examples. I use these as a basis for my own netcode.

Winsock

Server - http://msdn.microsoft.com/en-us/library/windows/desktop/ms737593%28v=vs.85%29.aspx

Client - http://msdn.microsoft.com/en-us/library/windows/desktop/ms737591%28v=vs.85%29.aspx

POSIX / BSD / UNIX Sockets

Server - http://www.linuxhowtos.org/data/6/server.c

Client - http://www.linuxhowtos.org/data/6/client.c

Of course there is also Boost.Asio if you want to use a pseudo standard library (Akin to .NET and Java sockets).

For UDP, have a look at the simple examples here - en.wikipedia.org/wiki/Berkeley_sockets

http://tinyurl.com/shewonyay - Thanks so much for those who voted on my GF's Competition Cosplay Entry for Cosplayzine. She won! I owe you all beers :)

Mutiny - Open-source C++ Unity re-implementation.
Defile of Eden 2 - FreeBSD and OpenBSD binaries of our latest game.

When I was creating a network video tutorial series I used Beej's Network Guide and it was quite handy: http://beej.us/guide/bgnet/output/html/singlepage/bgnet.html

I've heard a lot of good stuff about boost.

View my game dev blog here!

you can find lots of example code online to used the usual BSD sockets interface

the very first entry using keywords on yahoo "bsd socket example code c++" was :

http://www.cpp-home.com/tutorials/171_1.htm

--------------------------------------------[size="1"]Ratings are Opinion, not Fact

This topic is closed to new replies.

Advertisement