🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Confusion over TCP/IP.

Started by
5 comments, last by Thurgal 22 years, 6 months ago
Hi, I''m completely confused, everyone talks of TCP/IP being so easy but what language is it done in ? (I assume C++ or assembler) Also, I looked for a few beginning TCP/IP programming books but all the ones that looked promising were all talk and had no actual code examples, in fact all the books were complete theory. Is there a recommended book for cross-platform TCP/IP programming beginners ? If someone could help me out on this it would be much appreciated.
Advertisement
Hey there,

TCP/IP is a network protocol and by its very nature is language independent. It is a definition of how data should be transmitted between various machines. The protocol also defines error detection and an addressing scheme (IP.)

TCP/IP is normally read as TCP over IP. TCP defines various options such as packet sequencing and guaranteed delivery. IP is actually the addressing scheme and defines various low level stuff like routing etc. When people refer to UDP they are implicitly saying UDP/IP. TCP and UDP share the same addressing/routing scheme, IP.

The only limiting factor of using TCP or UDP is the API that is provided for you. Under Windows, for instance, Visual Basic can access TCP/UDP via the Winsock ActiveX control or directly through the C-language based Win32 API.

*nix boxes tend to use a implementation/flavour of something called Berkley Sockets.





Dire Wolf
www.digitalfiends.com
[email=direwolf@digitalfiends.com]Dire Wolf[/email]
www.digitalfiends.com
quote: Original post by Dire.Wolf
Hey there,

TCP/IP is a network protocol and by its very nature is language independent. It is a definition of how data should be transmitted between various machines. The protocol also defines error detection and an addressing scheme (IP.)

TCP/IP is normally read as TCP over IP. TCP defines various options such as packet sequencing and guaranteed delivery. IP is actually the addressing scheme and defines various low level stuff like routing etc. When people refer to UDP they are implicitly saying UDP/IP. TCP and UDP share the same addressing/routing scheme, IP.

The only limiting factor of using TCP or UDP is the API that is provided for you. Under Windows, for instance, Visual Basic can access TCP/UDP via the Winsock ActiveX control or directly through the C-language based Win32 API.

*nix boxes tend to use a implementation/flavour of something called Berkley Sockets.





Dire Wolf
www.digitalfiends.com


One other thing about UDP, it skips the CSMA/CD scheme for collision detection and you have to check yourself if a packet has been received or not by the recipient. When using UDP, there aren''t any packet schemes defined, you have to create a scheme yourself.



"And that''s the bottom line cause I said so!"

Cyberdrek

Resist Windows XP''s Invasive Production Activation Technology!

"gitty up" -- Kramer
/(bb|[^b]{2})/ that is the Question -- ThinkGeek.com
Hash Bang Slash bin Slash Bash -- #!/bin/bash
[Cyberdrek | ]
Ok ! That clears alot of things up for me, thanks. So, if you wanted to create a cross-platform TCP/IP system then you''d have to use a cross-platform SDK like Java ?
CMSA/CD is a link layer (ethernet) protocol and has nothing to do with TCP.


Mike
"Unintentional death of one civilian by the US is a tragedy; intentional slaughter of a million by Saddam - a statistic." - Unknown
Damn beat me to it, Vetinari. I always thought collision detection etc was defined at the layer below the Network Layer; i.e. Data Link layer. It is part of the Ethernet specification if I remember correctly.

Dire Wolf
www.digitalfiends.com
[email=direwolf@digitalfiends.com]Dire Wolf[/email]
www.digitalfiends.com
Thurgal,

Java would be one manner of doing that but it is not the only, or best, solution for a game. C-language programs have been using TCP/IP via Berkley Sockets on *nix boxes for ages. If you only use BSD 1.1 then *most* of the calls are supported under the Win32 Winsock API.

The best way to create a portable program that uses TCP/IP is to design it in a modular way. Use the Adapter or Wrapper Facade design patterns to encapsulate the differences in the various neworking APIs. Design patterns, for the most part, are langauge neutral; i.e. they can be applied to your language of choice.

Using design patterns allows you to take advantage of various API specific features that may be available in a given implementation. Features such as asynchronous I/O using I/O completion callbacks available to the Winsock WSAxxx series of functions etc. By hiding these differences using the Bridge, Adapter, or Wrapper Facade patterns, you make your application much more portable.

Since you seem to be looking for more answers, you might want to look into Berkey Sockets/Winsock compatibility and maybe some network design patterns (check out the ACE project.)

I''ll try and dig up some links for you.



Dire Wolf
www.digitalfiends.com
[email=direwolf@digitalfiends.com]Dire Wolf[/email]
www.digitalfiends.com

This topic is closed to new replies.

Advertisement