Data Transfer in Socket Programming
-
Hai All, I have a doubt regarding the transfer of Data in InterProcess communication like Socket Programming. ->Client and Server are two different Process running in two different machines ->Assume , I am passing a user defined structure from client process to Server Process. ->As usual I will fill the structure with values and pass the address of structure to the server process. ->My doubt starts here , since Server is another process running in another address space and also in another machine, how can the server fetch the values stored in the address given by client. Are they sharing any memory ??, if yes, where it resides ??, Thanks George
-
Hai All, I have a doubt regarding the transfer of Data in InterProcess communication like Socket Programming. ->Client and Server are two different Process running in two different machines ->Assume , I am passing a user defined structure from client process to Server Process. ->As usual I will fill the structure with values and pass the address of structure to the server process. ->My doubt starts here , since Server is another process running in another address space and also in another machine, how can the server fetch the values stored in the address given by client. Are they sharing any memory ??, if yes, where it resides ??, Thanks George
When you pass a "pointer" to be sent over a communication link (it can be serial port also), you supply also a size. So, what the send function is simply doing is copying X (the size you supplied) bytes starting at the address you supplied (the pointer). So, there is no magic there (or no shared memory or whatever). But, of course you have to take care that what you send is a pure data block (so, if there are pointers in your structure, the address will be sent, with no possibility to extract the data at the other side).
Cédric Moonen Software developer
Charting control [v1.2] -
Hai All, I have a doubt regarding the transfer of Data in InterProcess communication like Socket Programming. ->Client and Server are two different Process running in two different machines ->Assume , I am passing a user defined structure from client process to Server Process. ->As usual I will fill the structure with values and pass the address of structure to the server process. ->My doubt starts here , since Server is another process running in another address space and also in another machine, how can the server fetch the values stored in the address given by client. Are they sharing any memory ??, if yes, where it resides ??, Thanks George
georgekjolly wrote:
->As usual I will fill the structure with values and pass the address of structure to the server process.
:confused: What? It's not passing the pointer itself. We just tell the API function from where it should take the structure. We are pointing addresses to the function and NOT!! to the machine that's on the other end! -- modified at 11:53 Thursday 10th May, 2007
Press: 1500 to 2,200 messages in just 6 days? How's that possible sir? **Dr.Brad :**Well,I just replied to everything Graus did and then argued with Negus for a bit.
-
When you pass a "pointer" to be sent over a communication link (it can be serial port also), you supply also a size. So, what the send function is simply doing is copying X (the size you supplied) bytes starting at the address you supplied (the pointer). So, there is no magic there (or no shared memory or whatever). But, of course you have to take care that what you send is a pure data block (so, if there are pointers in your structure, the address will be sent, with no possibility to extract the data at the other side).
Cédric Moonen Software developer
Charting control [v1.2]Hi Sir, Thank you very much for ur Reply. Thanks and Best Regards George