
|
Sockets versus RPC
I am pretty new to computing - mostly as an amateur programmer on the weekends.
My question below may be dumb :
What is the difference between socket communication and RPC calls?
Do applications communicate to databases via sockets?
Hugo Boss
Friday, January 23, 2004
You can send anything over sockets: "sockets" is equivalent to "TCP" (or other low-level network protocols, like UDP). Specifically, "sockets" are to "network dialog" as "file handles" are to "disk files". "sockets" are a library available to application programs (on MS Windows the library is known as "winsock") for initiating and receiving any network data. There's a good chance that our web messages are being sent via "sockets" ... this message isn't RPC (in that I'm writing to a person, not invoking a procedure on a remote computer).
RPC means "remote procedure calls". RPC requires specifically-formatted data, agreed-on by the software at both ends of the [network] connection, to specify which remote procedure to invoke, what its parameters are, what its return value is.
RPC data may be (is usually) sent via sockets. There is more than one standard format for RPC data.
> Do applications communicate to databases via sockets?
Yes, except when they don't. Applications communicate to databases via database driver libraries. The libraries (on the application's computer) may use sockets to send data to the database's computer. Or, they may send the data using something other than sockets, for example if the database is on the same computer as the application ("IPC", inter-process communication, is a more general form of RPC, remote procedure call ... RPC is one of the types of IPC).
Christopher Wells
Friday, January 23, 2004
Sockets I'd say are layer 5 in the OSI model.
They provide the interface between applications and the transport layer (TCP/UDP).
RDP is layer 6 or layer 7 (it's debatable) in the OSI model.
They provide translation to a layer 5 protocol from an application. The interesting thing layer 6/7 is that all it "depends" on is having a layer 5 below it. That layer 5 may be a socket, it may be DB connector, it could be any sort of translation device.
Elephant
Friday, January 23, 2004
"> Do applications communicate to databases via sockets?
Yes, except when they don't."
Ah, I got a good chuckle out of that. :)
Dignified
Friday, January 23, 2004
As I understand it, RPC is just a layer of abstraction over sockets.
Andrew Burton
Friday, January 23, 2004
> As I understand it, RPC is just a layer of abstraction over sockets
I think RPC specifies what a function call looks like 'on the wire', i.e. it's the data format into which function calls (parameters, return codes) are serialised. An RPC implementation also includes tools that generate 'stub' code that serialises/deserialises your specific functions. It may (I don't know) have management (end-point discovery, security, reconnection) built in also. Finally it neededn't be over sockets (for example, "RPC" also works between two processes on the same machine, in which case the transport might be for example "pipes" instead of "sockets").
Christopher Wells
Friday, January 23, 2004
Oh, crud. I'm thinking XML-RPC, a web service over http. Ack!
Andrew Burton
Friday, January 23, 2004
Thanks for your posts :)
Hugo Boss
Friday, January 23, 2004
"Sockets" are a pretty low-level network abstraction. You're required to deal with potentially difficult issues like controlling socket handle lifetime, binding address to sockets, resolving human-readable (?) names into address, connecting, etc. Also, the two most common protocols used by applications on the Internet (TCP and UDP) each have some nasty "gotchas" that can make their use challenging.
"RPC" is a higher level protocol. It's also somewhat protocol neutral -- As long as the client and server have some shared/common network protocol installed (and assuming their RPC implementations play nicely) then the two can communicate. Under Windows, RPC works over sockets, named pipes, LRPC (a local-machine IPC mechanism), and a few others.
It's probably also worth mentioning that the programming model for the two are quite different. Sockets programs tend to see things in terms of bytes flowing back and forth across the network. RPC programs tend to use a request/response model: issue the request (RPC call), wait for a response.
Then there's SOAP, which (based on my meager understanding) is sort of an object-ish RPC over HTTP (over sockets).
Hope this helps.
Keith Moore
Sunday, January 25, 2004
"Then there's SOAP,"
A universal standard
"which (based on my meager understanding) is sort of an object-ish RPC over HTTP"
Uses an XML schema (at a SW "service" level. W3C is the standard, but MS may have another one that they tweaked (like with DHTML - when does MS ever leave a standard alone?). I can't think of what the competing standard is called, but I believe there is one.
"(over sockets)."
These sockets should provide a standard/universal API for SOAP to use.
Also, your security concerns against hackers are now focused in that HTTP layer.
I am a dilletante, too, so feel free to correct me.
Brian R.
Monday, January 26, 2004
"These sockets should provide a standard/universal API for SOAP to use."
Oh, right, that standard would be HTTP.
"Sockets I'd say are layer 5 in the OSI model.
They provide the interface between applications and the transport layer (TCP/UDP).
RDP is layer 6 or layer 7 (it's debatable) in the OSI model.
They provide translation to a layer 5 protocol from an application. The interesting thing layer 6/7 is that all it "depends" on is having a layer 5 below it. That layer 5 may be a socket, it may be DB connector, it could be any sort of translation device."
It makes sense to think of RPC as layer 6 and HTTP as layer 7. RPC is fixed, whereas HTTP is a superset - you can use HTTP to specify mime types .jpg, .bmp, etc, and XML - which can be used to create your own RPC shema, within the HTTP protocol.
Brian R.
Monday, January 26, 2004
Layer 7 is application, so it would be IE, while layer 6 is presentation which would be the file type, and layer 5 is session, which would be http as far as my understanding goes.
RPC will run at layer 5, as it manages sessions. It calls the appropriate procedures for the session, while the application and presentation layer get the data ready to send through the session.
Sockets would be a way to set-up sessions, and when you are setting up your sessions, you will tell the socket what it should be opening in lower layers.
I might be wrong in this, and if so, would greatly appreciate corrections.
Regards,
menno
menno
Sunday, May 16, 2004
Recent Topics
Fog Creek Home
|