I wanted to know how to flush the socket streams while doing socket programming in C. I tried all the options- setting `TCP_NODELAY` using the following code- 

```
setsockopt(sockfd, IPPROTO_TCP, TCP_NODELAY, (char *) &flag, sizeof(int));      

```

Note: all the `flag` and `sockfd` are declared correctly.

I used this function both before `send(`) and after `send()` but it did not make any difference. 

Also someone had suggested to use `shutdown()` after each `send()` but that works only for one instance. When I use it to send some text again, it doesn't work- actually the connection gets closed after I use `shutdown()`. 

```
shutdown(sockfd, SHUT_WR);

```

Can someone help in this regard? 

I wanted to added that- the server is a Java socket and the client is a C socket. The C socket implements the JVMTI interface and sends the information to the Java socket.