Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 TCP vs Sockets: A request for elucidation! (test your knowledge)
Index -> General Discussion
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
jackthechemist




PostPosted: Sun Mar 28, 2010 11:54 pm   Post subject: TCP vs Sockets: A request for elucidation! (test your knowledge)

Greetings,

So, I've studied sockets, and studied TCP, and enjoy a beginner-intermediate understanding of each. However I desperately need clarification regard some fundamental concepts. Any help would be greatly appreciated:

1) Do sockets implement TCP? When I uses a socket to send data to another computer, are the computers using TCP or is it my responsibility to implement it (ie write the program such that the methods of the sockets mimic the rules dictated by TCP) I am confused.

2) I've read most of the RFC regarding TCP. It mentions a 'user interface'. Further, it specifies various TCP 'commands'. If MSN / Pidgin is using TCP, how could I use say C / Python to send 'TCP commands' and if MSN / Pidgin is merely using sockets to do this and the OS is responsible for TCP implementation then how can i send say a TCP header (consisting of 1s and 0s) manually? I know how to manually send HTTP requests manually, how can i do this with TCP?

Before you respond, please note, I'm not a programmer, I'm a chemist (I just happen to love computers) so for my sake, try to answer accordingly! ^_^

Jack
Sponsor
Sponsor
Sponsor
sponsor
DtY




PostPosted: Mon Mar 29, 2010 3:10 pm   Post subject: RE:TCP vs Sockets: A request for elucidation! (test your knowledge)

TCP is implemented largely in hardware (and the rest in the operating system or libraries), so you don't actually use TCP directly (unless you were doing low level hardware programming).

Sockets is a library that gives an interface to TCP (it can also do UDP, and I suppose it would be possible to make a library that would implement other low level protocols). It gives you convenience stuff like buffering and an interface that is cross platform.

I'm not sure if you can access TCP directly, you can't in a platform agnostic way, at least.

It's probably best to think of sockets like using the file functions to open a file and write to it rather than using whatever method on the operating system to write directly to the sectors on the disk.
jackthechemist




PostPosted: Sat Apr 03, 2010 4:55 pm   Post subject: Re: TCP vs Sockets: A request for elucidation! (test your knowledge)

Cool. Thanks for the advice.
peeterparker




PostPosted: Mon Apr 26, 2010 11:17 pm   Post subject: RE:TCP vs Sockets: A request for elucidation! (test your knowledge)

Excellent answer
Display posts from previous:   
   Index -> General Discussion
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: