Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
09-14-2010, 06:49 AM
|
#1
|
LQ Newbie
Registered: Apr 2010
Location: Delhi, India
Distribution: openSuse
Posts: 6
Rep:
|
about linux sendto
Hi,
I just need to get this clarified. When we send character data buffer with sento over udp socket, does sendto make a copy of the buffer or does it just take the pointer and size and send the data buffer from pointed location.
I ask this for understanding that would it be legal or illegal to allocate a memory buffer then call sendto in non-block mode and then immediately delete the allocated memory, or, a case where we keep a common buffer and in a loop change the value of buffer and call sendto.
Regards,
Mandeep
|
|
|
09-14-2010, 09:14 AM
|
#2
|
LQ Guru
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,351
|
If it sent a pointer, then how would the remote machine be able to access the data? The remote machine can't read memory on the local machine.
I haven't actually checked this, but I think it must send a copy of the buffer.
Last edited by dugan; 09-14-2010 at 09:19 AM.
|
|
|
09-15-2010, 12:45 AM
|
#3
|
LQ Newbie
Registered: Apr 2010
Location: Delhi, India
Distribution: openSuse
Posts: 6
Original Poster
Rep:
|
Quote:
Originally Posted by dugan
If it sent a pointer, then how would the remote machine be able to access the data? The remote machine can't read memory on the local machine.
I haven't actually checked this, but I think it must send a copy of the buffer.
|
Hi, actually I meant that the sendto might just read from the buffer location via the pointer passed and send out data directly from the pointed buffer instead of making its own copy. I wanted to be sure of what is happening and how it happens.
Regards,
Mandeep
|
|
|
All times are GMT -5. The time now is 06:25 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|