Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old May 29th, 2006, 10:45 AM   #1
hbe02
Hobbyist Programmer
 
hbe02's Avatar
 
Join Date: Mar 2006
Location: Lebanon
Posts: 148
Rep Power: 3 hbe02 is on a distinguished road
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?
hbe02 is offline   Reply With Quote
Old May 29th, 2006, 10:52 AM   #2
nnxion
Programming Guru
 
nnxion's Avatar
 
Join Date: Jun 2005
Location: elemental plane
Posts: 1,429
Rep Power: 5 nnxion is on a distinguished road
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
nnxion is offline   Reply With Quote
Old May 29th, 2006, 10:53 AM   #3
Serinth
Programmer
 
Serinth's Avatar
 
Join Date: Sep 2005
Posts: 50
Rep Power: 4 Serinth is on a distinguished road
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.
__________________
A girl talked to me once.

http://www.latestanime.com
Serinth is offline   Reply With Quote
Old May 29th, 2006, 10:54 AM   #4
free-zombie
Programmer
 
free-zombie's Avatar
 
Join Date: May 2006
Location: Bavaria, Germany
Posts: 50
Rep Power: 0 free-zombie is an unknown quantity at this point
Send a message via ICQ to free-zombie Send a message via MSN to free-zombie Send a message via Yahoo to free-zombie
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
free-zombie is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 6:04 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC