![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Hobbyist Programmer
Join Date: Mar 2006
Location: Lebanon
Posts: 148
Rep Power: 3
![]() |
Socket Limit
im using a AF_INET socket as such:
sd = socket(AF_INET, SOCK_DGRAM, 0); im sending and recieving char * buffer = new char[array size] im sending and recieving 1's and 0's.. each 1 or 0 is stored in buffer[i] . problem is, if buffer is more than 65000 1's and 0's .. (65000 characters long) send buffer sending fails.. is there a limit to the size of character array you can send? |
|
|
|
|
|
#2 |
|
Programming Guru
![]() Join Date: Jun 2005
Location: elemental plane
Posts: 1,429
Rep Power: 5
![]() |
As far as I know not. You should show some more code.
__________________
"Employ your time in improving yourself by other men's writings, so that you shall gain easily what others have labored hard for." -- Socrates |
|
|
|
|
|
#3 |
|
Programmer
Join Date: Sep 2005
Posts: 50
Rep Power: 4
![]() |
I don't know if there's a limit but i do know that sometimes you won't be able to send all the bytes (from beej's guide). In this case the remaining bytes in your buffer are still there waiting to be sent. You could write a separate function to handle how many bytes have been sent and then send the remaining bytes.
|
|
|
|
|
|
#4 |
|
Programmer
|
why are you sending 0's and 1's ?
leaving that aside, you shouldn't make UDP packets too large. If you have no specific reason not to use TCP, use it as it is simpler. I have heard that a 1K UDP datagram is quite large. You want to send a > 0xFFFF byte long one ? 0xFFFF sounds like a reasonable technical limit; but you should just split it up. EDIT: SOCK_DGRAM means UDP. SOCK_STREAM is TCP. datagram data is not queued by the TCP/IP stack of the OS. TCP is - as the OS controls the packets anyway |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|