New programmer and network.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

While teaching myself to program, I've undetaken a little game project akin to Battleship only it's not turn-based. The stand-alone version is working fine but I'd like to expand it to include a head-to-head feature.

With the program running on two computers, I wish to manually input the IP of the opponent into each. Then, I expect each event handled by one program to generate a network message received and interpeted by the opponent.

I was expecting (hoping) to find something like TCP.Send(target IP, target Port, string) but no such luck. Instead, I seem to be hung up on two issues I hadn't really anticipated: sockets and blocking/non-blocking.

Can someone advise me where to follow up on this? I could use some very basic pointers.
 
I was expecting (hoping) to find something like TCP.Send(target IP, target
Port, string) but no such luck. Instead, I seem to be hung up on two issues
I hadn't really anticipated: sockets and blocking/non-blocking.

DirectPlay provides a complete framework to help implement a networked game,
I'd suggest you use that. There are many issues with networking and using
raw sockets makes a lot of work for yourself. The DirectX SDK can be
downloaded at http://msdn.microsoft.com/directx.

n!
 
Thanks, n!, that makes considerable sense. I guess it would be the way to go if the primary objective of this little game weren't to teach me how to program in general :) I really want to overcome this basic networking issue... just to send and receive packets. I don't even care about timing yet!
 
Thanks, n!, that makes considerable sense. I guess it would be the way to
go if the primary objective of this little game weren't to teach me how to
program in general :) I really want to overcome this basic networking
issue... just to send and receive packets. I don't even care about timing
yet!

Well it's not all about timing, there's management of dropped\lost packets
amongst other things :)
If you really want to look at sockets & raw communication I'd suggest
looking at the 'WinTalk' sample that is installed with the .NET framework
SDK (should be under \samples\Applications\Wintalk). Which implements a
simple 'chat' application using sockets. Should be enough there to get you
going!

n!
 
Back
Top