-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changing some names in module "net"? #59
Comments
I'm not against, but would it make sense to just overload the |
It would be problematic for the string type, which can be sent in two forms: raw bytes and boxed bytes with type information. |
It's not some TCP socket. It is a connected socket you can read from and write to, which distinguishes it from
I named them differently because 'reading from address' and
I think you approach the problem from the wrong side. Sockets don't need to have hard-coded support for transmitting Dao data. Now there are |
Generally, means for data encoding should come separately from means for data transfer, unless you implement a protocol which encompasses both. Sockets are meant to be abstract over data representation, which is the job of a higher-level layer, e.g. HTTP. So I advise either to provide separate implementation of Dao data serialization, or to implement a dedicated full-blown L5 protocol for that. |
@Night-walker you're right except for the reasoning about not using |
I know there is a difference in handling TCP and UDP protocol. But a connected socket is still a socket, I don't think it is far off to use
No need to complicate things.
Right. I will create derived types from
Clearly sending and receiving Dao values requires to define a simple protocol. My intention is that on top of this simple protocol, users can easily define their own protocols, by structuring their data into appropriate tuples and send/receive these tuples directly. And I probably cannot wait for an implementation for a full-blown L5 protocol. |
msgpack is created exactly for this purpose and it's getting very widespread - apparently it's simplicity and versatility pays off. |
Then
Why two identical types which only differ in method names?! That would have been even more puzzling. I'd rather add
Better add types which wrap sockets. Then you won't need to provide alternative
I'm very sceptical about the use of such protocol, as it assumes that both the sender and the recipient are implemented in Dao. That is a very limiting choice for a very narrow use case. I would use a well-known binary serialization format instead.
Certain data coherency measures should still be implemented to receive Dao values 'atomically' -- together with encoding/decoding it will be an L5 protocol :) |
OK, I seem
Then there will need some code refactoring for this. But I agree this is the better way to go.
If one decides to use customized protocol, I doubt he/she will use two different languages, unless for some special reason.
Receiving Dao values atomically is exactly what I need. |
So, should we add |
I'd also prefer the latter, but it's not a strong preference. |
The later is Ok for me. |
Done. |
I wonder if we should change
net::TcpStream
tonet::TcpSocket
. It does conform to theio::Device
interface, but it is not really necessary to be calledStream
, right? Calling itTcpSocket
would be closer to what it really is, and be more consistent toUdpSocket
.I am also considering to change
UdpSocket.send()
toUdpSocket.write()
, andUdpSocket.receive()
toUdpSocket.read()
, in order to be more consistent to the TCP type.Then I will add a new
UdpSocket.send()
for sending Dao values, andUdpSocket.receive()
for receiving Dao values. I really do need such methods, as they are very handy to use. Primitive values and their aggregations can be supported.The text was updated successfully, but these errors were encountered: