![]() |
| | #1 |
| Registered User Join Date: May 2006
Posts: 630
| select model sockets I work on a select model socket client, where I have many outgoing connections that are being handled by 1 thread. Is there anything that I should be aware of when im doing send and recv call? Are there any possibilities I wouldnt get all the data when socket is ready to read? I have made a socket class where I have information for each socket stored. Would it be better to make a pointer char for recv buf in a class, when recieving data on read call. Is there any need for that? Would it be smart to use ioctl(The_Socket, FIONREAD, &num_bytes); to get the number of bytes that are ready to read, to allocate the memory in the buffer or just allocate some number, and then loop with recv? Also another question, would it be better to loop when sending data till all data is sent like Code: do {
ret=send(The_Socket,buf,count,0);
count-=ret;
buf+=ret;
} while(count>0);
Thanks a lot for your help |
| l2u is offline | |
| | #2 | ||
| Registered User Join Date: Jan 2005
Posts: 847
| Quote:
Quote:
Check your platforms documentations for send, it may not be necercary to loop. | ||
| Quantum1024 is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| brace-enclosed error | jdc18 | C++ Programming | 53 | 05-03-2007 05:49 PM |
| program structure with select sockets | n3v | Networking/Device Communication | 9 | 06-03-2006 06:34 AM |
| multiple UDP sockets with select() | nkhambal | Networking/Device Communication | 2 | 01-17-2006 07:36 PM |
| Help with file reading/dynamic memory allocation | Quasar | C++ Programming | 4 | 05-17-2004 03:36 PM |
| FAQ: Directional Keys - Useing in Console | RoD | FAQ Board | 38 | 10-06-2002 04:42 PM |