473,405 Members | 2,379 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

How to talk to peers over the internet?

Hi,

I am writing a game that I want to net enable.

So I want to be able to connect to peers over the internet. I will
be sending very small packets of data.

What is the best way to do this?

Do I need a middle man server?

Can someone outline how to do it please?

rotsey
Jul 25 '07 #1
5 2488
I would probably start by lookign at creating some form of UDP server and
listeners, though its not my area of expertise related to gaming.

http://www.codeproject.com/vb/net/TinyUDP.asp

UDP is a very lightweight comms approach so it might be the right approach
for you.

Regards

John Timney (MVP)
http://www.johntimney.com
http://www.johntimney.com/blog

"Rotsey" <ma***********@RemoveThis.optusnet.com.auwrote in message
news:%2******************@TK2MSFTNGP04.phx.gbl...
Hi,

I am writing a game that I want to net enable.

So I want to be able to connect to peers over the internet. I will
be sending very small packets of data.

What is the best way to do this?

Do I need a middle man server?

Can someone outline how to do it please?

rotsey

Jul 25 '07 #2
Ok John thanks

One thing, I was hoping for a solution that would not mean I have
to create a server app as i do not have access to a server. So
I would have to pay for a web host.

Is there a solution that is already up like peer to peer graph,
but that requires softqre to be installed on each peer which
and setup issues I think as well??
"John Timney (MVP)" <x_****@timney.eclipse.co.ukwrote in message
news:Ro*********************@eclipse.net.uk...
>I would probably start by lookign at creating some form of UDP server and
listeners, though its not my area of expertise related to gaming.

http://www.codeproject.com/vb/net/TinyUDP.asp

UDP is a very lightweight comms approach so it might be the right approach
for you.

Regards

John Timney (MVP)
http://www.johntimney.com
http://www.johntimney.com/blog

"Rotsey" <ma***********@RemoveThis.optusnet.com.auwrote in message
news:%2******************@TK2MSFTNGP04.phx.gbl...
>Hi,

I am writing a game that I want to net enable.

So I want to be able to connect to peers over the internet. I will
be sending very small packets of data.

What is the best way to do this?

Do I need a middle man server?

Can someone outline how to do it please?

rotsey


Jul 25 '07 #3
Hi rotsey,
The reason communications packages usually need a server is because it may
be the only way for users of that application to broadcast their presence to
other users..
Another reason is because it's not easy to traverse inwardly through routers
to someone's pc from the internet.
I believe that similar problems are solved by using nodal networks like bit
torrent, but I think there always has to be a known server/node running to
seed the network.

If you know the IP addresses of your peers and can enter those into your
communications application directly, you dont need a server.
All you need, as john says, is UDP listeners running and passing very small
packets. You yourself would have to design the chat protocol.
Ok John thanks

One thing, I was hoping for a solution that would not mean I have
to create a server app as i do not have access to a server. So
I would have to pay for a web host.

Is there a solution that is already up like peer to peer graph,
but that requires softqre to be installed on each peer which
and setup issues I think as well??
Jul 25 '07 #4
On Wed, 25 Jul 2007 21:17:09 -0700, Rotsey
<ma***********@RemoveThis.optusnet.com.auwrote:
[...]
Would UDP be ok for this when it is fairly critical for that data to
arrive
promptly and not duplicated.
UDP does have the advantage that there's no built-in delay mechanism. TCP
uses the Nagel algorithm, which delays some transmissions for a very short
period of time, in case additional data is sent that can be combined with
the previously sent data...this is more efficient, but of course causes
some data to be sent later than it otherwise could have been.

Keep in mind that even though UDP in theory can result in more timely
delivery at least some of the time, in practice you may not realize the
benefit. It all depends on the network traffic, and things like whether
coalescing TCP traffic improves communication efficiency enough to reduce
lost IP datagrams forcing data to be resent.

IMHO, if you have a need for reliable delivery, you should just use TCP.
Don't switch to UDP unless you find that you have some serious problems
with the timeliness of the data, and even then don't expect switching to
UDP to be a panacea.

If you don't have a need for reliable delivery, and can easily implement
whatever minimal validation you do need, then UDP might be a good choice.
[...]
Pete, is port tunneling the same thing as "Hole punching"?
I have heard both terms used for the same thing, yes.
Is this easy to do for a first timer?
The basic idea is easy. Two different client contact a common server
reachable by both. The common server reports each client's actual network
address information to the other, and the clients then use that
information to attempt to contact each other directly.

Getting it to work in practice is tricky, mainly because there's no
specification requiring NAT routers to support it. So the first step in
testing an implementation is somehow making sure you're using a NAT router
that will behave in a way for port tunneling to work.

There was a recent article that I saw on the web six or twelve months ago
on the topic that was pretty detailed. I'm sorry I don't have the URL
handy, but a Google search may turn up something for you.

Personally, I'm not sure I would bother with it. It will only work with
some NAT routers, it does have the requirement of a public server your
peers can all reach, and you will be better off supporting something like
UPnP (not 100% available, but getting pretty close these days) and being
prepared to offer at least some minimal guidance to customers for
configuration of their routers to support your program.

Pete
Jul 26 '07 #5
ok thanks Pete again

"Peter Duniho" <Np*********@nnowslpianmk.comwrote in message
news:op***************@petes-computer.local...
On Wed, 25 Jul 2007 21:17:09 -0700, Rotsey
<ma***********@RemoveThis.optusnet.com.auwrote:
>[...]
Would UDP be ok for this when it is fairly critical for that data to
arrive
promptly and not duplicated.

UDP does have the advantage that there's no built-in delay mechanism. TCP
uses the Nagel algorithm, which delays some transmissions for a very short
period of time, in case additional data is sent that can be combined with
the previously sent data...this is more efficient, but of course causes
some data to be sent later than it otherwise could have been.

Keep in mind that even though UDP in theory can result in more timely
delivery at least some of the time, in practice you may not realize the
benefit. It all depends on the network traffic, and things like whether
coalescing TCP traffic improves communication efficiency enough to reduce
lost IP datagrams forcing data to be resent.

IMHO, if you have a need for reliable delivery, you should just use TCP.
Don't switch to UDP unless you find that you have some serious problems
with the timeliness of the data, and even then don't expect switching to
UDP to be a panacea.

If you don't have a need for reliable delivery, and can easily implement
whatever minimal validation you do need, then UDP might be a good choice.
>[...]
Pete, is port tunneling the same thing as "Hole punching"?

I have heard both terms used for the same thing, yes.
>Is this easy to do for a first timer?

The basic idea is easy. Two different client contact a common server
reachable by both. The common server reports each client's actual network
address information to the other, and the clients then use that
information to attempt to contact each other directly.

Getting it to work in practice is tricky, mainly because there's no
specification requiring NAT routers to support it. So the first step in
testing an implementation is somehow making sure you're using a NAT router
that will behave in a way for port tunneling to work.

There was a recent article that I saw on the web six or twelve months ago
on the topic that was pretty detailed. I'm sorry I don't have the URL
handy, but a Google search may turn up something for you.

Personally, I'm not sure I would bother with it. It will only work with
some NAT routers, it does have the requirement of a public server your
peers can all reach, and you will be better off supporting something like
UPnP (not 100% available, but getting pretty close these days) and being
prepared to offer at least some minimal guidance to customers for
configuration of their routers to support your program.

Pete

Jul 26 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

77
by: nospam | last post by:
Reasons for a 3-tier achitecture for the WEB? (NOTE: I said, WEB, NOT WINDOWS. DON'T shoot your mouth off if you don't understand the difference.) I hear only one reason and that's to switch a...
0
by: Michael Sparks | last post by:
Hi, Apologies first to those outside the UK... Open Tech 2005* is a follow on from previous years' NotCon events which are community driven low cost events by geeks & developers for geeks &...
3
by: Greg Liles | last post by:
I've logged into an ASP.Net server through my browser. My browser runs an activex control. The activex control starts an activex EXE that needs to communicate to the server. The problem is when...
1
by: Jon Shemitz | last post by:
Theoretically, my long-delayed .NET 2.0 book (<http://www.midnightbeach.com/dotnet>) will be DONE and handed off to the copy editor by Jan 31. My shoulder's giving me trouble and I might miss that...
3
by: Robb Gilmore | last post by:
Hi, I need to write a C#.NET PC application that can talk to a non-windows device using a USB-IrDA adapter. I have been searching for information about how to do this, and the bext info I have...
0
by: Jeff Rush | last post by:
October has arrived and the deadline for submitting a proposal to give a talk at PyCon 2007 is October 31 (November 15 for tutorials). While it is a PyCon tradition to wait until the last minute...
0
by: GHUM | last post by:
We took longer then planned to open the registration. Some potential speakers came in late. To make it even, we extended talk submission deadline for ONE WEEK. New deadline is Friday, 25th...
3
by: Rotsey | last post by:
Hi, I am writing a game that I want to net enable. So I want to be able to connect to peers over the internet. I will be sending very small packets of data. What is the best way to do this?...
2
by: Rotsey | last post by:
Hi This a related question to recent post. I am thinking of using webservices to handle comms for a game I am dev. But not sure you when sending data to a webservice how it broadcasts that...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.