By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,696 Members | 2,213 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,696 IT Pros & Developers. It's quick & easy.

New programmer and network.

P: n/a
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.
Nov 15 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
n!
> 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!
Nov 15 '05 #2

P: n/a
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!
Nov 15 '05 #3

P: n/a
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!

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!
Nov 15 '05 #4

P: n/a
Excellent, n!! I didn't even know about the samples directory. Thanks a lot :)
Nov 15 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.