SupposeIi have a server program which is written in java, and the client program in C. How can I establish a communication link between them using TCP connection?
The language in which these programs are written is not relevant, so long as they offer a means to utilize a socket library (and both Java and C do, of course). The standard approach would be for the server to run a thread that opens a TCP socket in listening mode on a specific port number, waits for incoming connections, and then spawns a thread when a remote process connects, even as the listening thread continues to wait for additional incoming connections. (If you only expect one client to connect at any given time, this thread business is not needed.) The client program opens a TCP socket, connects to the server's IP address and port number, and start communicating.
How the two communicate is up to you. Presumably, you'll want to design a command protocol or borrow/extend an existing protocol. If possible, I prefer to use a human-readable protocol, as it makes it easier to test the server by simply connecting to it using telnet and issuing commands manually. One thing you might want to pay special attention to is security (both to authenticate clients to prevent unauthorized access, and to vet anything received from a malfunctioning or hacked client). Another thing to pay attention to is to make sure the server detects "hung" clients (e.g., TCP connection issues) and frees up resources appropriately.
Other than that, there are plenty of examples on the Web, e.g., Google "java tcp server code". And as I said above, you can mix-and-match a Java server with a C client, so long as they both speak the same command protocol (i.e., the commands sent by the client are consistent with what the server expects.)
One other method - JNI. One advantage of this is that you can call the java methods from C and vice-versa, however, the downside is JNI is more prone to Segmentation faults, and can crash your JVM.