Hello,
I've a quite simple question about socket programming (but I can't find the answer in widely available sources). Is it possible to 'reuse' a socket within 1 connection? In other words, is it possible to place 'send()' and 'recv()' in a loop in the code below? In that case time will be saved because the socket doesn't have to be opened and closed for every new buffer. The socket desciptor stays the same, the only thing that has to be changed is the message buffer.
socket();
connect();
send(); //instead, while(1) {buffer = "new buffer"; send(buffer); recv();}
recv(); // "
close();
Thanks!
I've a quite simple question about socket programming (but I can't find the answer in widely available sources). Is it possible to 'reuse' a socket within 1 connection? In other words, is it possible to place 'send()' and 'recv()' in a loop in the code below? In that case time will be saved because the socket doesn't have to be opened and closed for every new buffer. The socket desciptor stays the same, the only thing that has to be changed is the message buffer.
socket();
connect();
send(); //instead, while(1) {buffer = "new buffer"; send(buffer); recv();}
recv(); // "
close();
Thanks!
Comment