Creating a TCP client-server in C is fairly complicated and a lot of people use bad practices to accomplish it (like manually filling out the ip address struct). If you want to learn C socket programming that I HIGHLY recommend Beej's Guide to Network Programming (this is all freely available info on his webpage): http://beej.us/guide/bgnet/
Frankly, imo, C/C++ is a HORRIBLE language to do network programming in. Java is a MUCH MUCH better language for network applications. If all you want to do is TCP/UDP or even SSL sockets, then Java can do the job and it's much easier than in C. Now, if you want to do things at an even lower level than TCP/UDP, then C might be the way to go (i.e. sending raw IP datagrams).
Here are the problems with C/C++:
1) have to worry about different compilers. So a struct on your machine may very well be of different length than the SAME struct on another machine (it's compiler dependent). This means you must encapsulate your data yourself and make sure it's read and written the correct way.
2) You have to worry about byte order. So if you try to communicate between a Little Endian machine and a Big Endian machine, you are going to have to make sure that you first, send your data through hton (host to network) (which basically ensures your data is Big Endian), then on the reading side, send it through ntoh (network to host) to make sure the Big Endian network order gets converted to your machine (which may or may not do ANYTHING)...but you HAVE to do this to ensure you have functionality between machines that may or may not have different byte ordering.
Neither of these things are issues in Java:
1) All primitive types in Java have preset lengths. So an int is always 4 bytes, a short is always 2 bytes, etc. Furthermore, there are methods for writing these primitives to a datastream (i.e. the socket's datastream). You still need some form of encapsulation (i.e. if you want to transmit an object, then you will have to have writer and reader methods).
2) Java is ALWAYS Big Endian, regardless of your machine, so there is no need to worry about byte order with Java.
Edit:
I don't get at all what UnfaithFull is saying. I'm not going to argue that communicating with servers via TCP isn't going to be difficult and almost certainly not worth the trouble. However, if you are writing your OWN client/server (which is what I assumed) then this is just fine. Your only real obstacle with using TCP is adhering to the protocol. Again, I don't doubt that you should use software that is already written, but it's not impossible or even that difficult to do it yourself.
As an example, I'm fairly confident that I could write a C program that could get the HTML text from an HTTP server using nothing but low level TCP (i.e. http://www.google.com) (it would be 100s of times easier in Java, but it's doable in C)...
Edit:
Here is C code which uses low-level TCP sockets to connect to an HTTP server and retrieve data (it's 185 lines): http://ideone.com/HVl2wM
There is absolutely no error checking whatsoever in this code. It works because I specify a non-persistent connection, so I can just read the TCP data until I get an error (which should mean that the server closed the connection).
This program will retrieve the HTML text from whatever website you specify. I noticed that www.facebook.com didn't really work because it wanted you to redirect to an https URI so this might not get HTML for all websites (also it only gets the root page from the domain). So this is by no means a "robust" program, but it should show you how to use TCP to connect to a server and furthermore that you CAN connect to servers with low-level TCP connections (although, I'll still admit, it's cumbersome and other software should be capable of making it easier).
Just to give you some idea, here is the equivalent Java code: http://ideone.com/DVMbjD
Notice that this is 69 lines (that's counting the fact that the 8 import lines could have been condensed to 2, meaning this is about 1/3 of my C code). Notice how much simpler and more straightforward the Java code is. I'm sure if you talked to Python people that they would say they could do it in even fewer lines, but I still think Java is far better than C when it comes to network programming (nothing I did ever touched on the problems of different compilers or byte order...I was always sending char's which are always 1 byte in C).