Комментарии:
Leave a comment, let me know what YOUR favorite networking library is!
Ответитьthat's cool, but what about performance tradeoff?
ОтветитьLocalHorse Gang checking in here
ОтветитьBro i just love the things you do like socket code was a headache for many months but thanks to you now Im relieved
ОтветитьLocalhorse..
ОтветитьZeromq rocks
ОтветитьI love this video. Thank you so much. Now i want MORE SOCKET RELATED PROJECTS
ОтветитьThis got my attention 😮😮
Ответитьat first looking at the title I thought this man was gonna interface the network card directly
ОтветитьBro is asking to get hacked.
Ответитьvery rarely people talk about zeromq
ОтветитьThis is sweet. Sockets is fine but I'm already bangin away at some crazy stuff with this API. Thanks L3!
ОтветитьIn my day job (sadly) I do a lot of web development... this seems very familiar. Nice.
ОтветитьThanks. Maybe someday it’d be great to do the same thing in sockets, revisit 0mq at the same time… sort of a compare and contrast.
ОтветитьIt would be nice a Demo using libcurl library and then integrates with a json parser library 😉. Great video 🙏
ОтветитьDude doesn't know what Ø is
ОтветитьI've heard of ZeroMQ but not CZMQ. Is it like a more simplified version?
As for my favorite net lib? In C, I'm using the sockets API directly, with Winsock startup/shutdown boilerplate, because I need like raw TCP/UDP a lot of the time. I want to use Rust, but that's where networking gets... complicated, especially with concurrency, which I'm also struggling with, though the channel semantics look promising. The `tokio` crate seems like the go-to, but if you need a program to do expensive calculations as well (ie. a server-side authority game server), that's where it falls short. I was told to use std::net in conjunction with the `rayon` crate in such cases, but concurrency and networking on that scale makes brain soup.
Nice video but It reminds me why I don't like programming in C for networking. Header files, **, * &, free etc
ОтветитьWhat I like about sockets are the IO Strategy, especially multiplexing, to handle multiple sockets, using select option to select only the sockets that has pending data, and IOCTL where you can check the state of a socket or set a block state to a socket.
For socket strategy there is IOStrategy, Async and Multi-threaded,
- IO strategy uses a single thread where it selects sockets that have pending data to handle them,
- Async uses opens and closes or uses a thread-pool to handle sockets in separate threads, if you have to synchronize data received from the sockets you have to synchronize it manually
- Multi-threaded handles sockets in separate threads, in my opinion multi-threaded should be avoided, it is the easiest to handle but the slowest when handling a lot of clients,
- There is also an hybrid mode where using IO Strategy in separate threads as socket channels, for example
I also wrote 3 layers of abstraction for the socket library in c++, Socket->DataSocket ->Listening and Connection socket, after this I wrote the communication protocol, because send and recv, does not ensure, you will receive the full message, because if the message is too big, it will be broken into chunks or receive part of the next message, especially if you have blocking turned off per socket
A good socket library should have options to use their own strategy(IOStrategy, Async, Multi-threaded, etc,) to handle sockets, an easy to use listening and connection socket, also a communication protocol,
Do you have / are you going to make a video on the Linux Sockets API?
ОтветитьØMQ is a facade then? It kinda sounds like a Plan9 channel.
Ответитьlocalhorse
ОтветитьAwesome video, that PTSD from the socket API got me looking for alternatives. Thank you very much!
ОтветитьYou aren't checking that zsock_new isn't returning NULL.
Ответить> networking in c but without all those pesky sockets
> so we're going to be using zsock
you need to shift your video back a little the slight audio desync is fucking killing me
Ответитьgente una pregunta paa mi tarea xd, he notado que las ip en el router termina en .0.123 por ejemplo y en mi compu la ip termina en .0.14, mi duda, ¿entonces las ip de las computadoras son heredadas de la ip del router o me equivoco? es para una tarea
ОтветитьSpent all day trying to compile ZeroMQ in Visual Studio 2019 with its C++ binding. Learned I've to move on and find something else. Maybe I can compile its C binding on Linux and use the generated library back on Visual Studio (Windows)? Don't want to lose more hours. Also, couldn't find an understandable example of how to implement async named pipes on Windows with C++.
ОтветитьInteresting how zmq have stuff running post main to detect non freed resources. Maybe that's a signal handler or something, will grep for dangling in the source when I have an opportunity. Thanks for the video!
ОтветитьWhy didn't localhost work on the server side?
ОтветитьDidn’t you need to allocate a number of bytes for the returned msg string? You just have char *msg in the server and char *str in the client without allocation. Maybe I’m looking too far into this quick demo but just curious as welll.
ОтветитьRemove `sleep(1);`
ОтветитьHave you heard about DDS?
ОтветитьThis is messaging middle-ware and not network programming. They are different users completely. And not just an abstraction.
Also the TCP/IP network programming API is from UNIX not Linux.
Before investing your time in 0MQ, here are a few considerations:
* The sockets API is well documented, and underlies all IP based networking software. You'll need to learn it sooner or later.
* 0MQ is not a replacement for the sockets API; rather, 0MQ is a pub/sub networking toolkit built on top of the sockets API.
* NATS is a similar pub/sub toolkit which is widely used in industry, but with better intrinsic security than OMQ.
* If you want to write networking software which is as reliable as possible, you will need to learn how to use non-blocking I/O with a single thread. 0MQ (and NATS) kick this can down the road by using seperate threads under the hood to buffer messages.
I tried to use zmq once in the project, but realized that it does not guarantee delivery on its own. I read parts of zmq source and it appears to me that data, which was sent from zmq and is then in OS network buffer, may get lost when TCP connection will break. Zmq will do re-connection for you, but data from OS buffer may never get to the destination. So without implementing some acknowledge protocol over zmq messages I could not be sure that data put to zmq will be actually delivered. I tried to do that and it was like re-implementing TCP in simplified form. Another solution I came up was to listen to socket events (or whatever it was called) and reacting on disconnections in some way.
Ответитьand that's why I don't like c. global namespace everything.
ОтветитьI remember the semester where the pandemic started, my system programming course had us do an IRC client. It was a mess. I'd comfortably say I was the most advanced in the class and I barely managed to finish it.
ОтветитьI used ~5 years ago zmq for a RADAR-System to transmit processed I/Q-Data to a websocket-server. From there on, the clients received the data via websockets inside the provided web application.
ОтветитьAwesome! Looks promising for embedded devs.
ОтветитьI have been using ZMQ for awhile now to build distributed computing software for Manufacturing and Execution Systems and it works really great... can do anything from normal pub sub and req resp patterns to esoteric patterns like radio dish and multi stage compute pipelines. Maybe someday someone can show it working on an ESP32 or similar...
ОтветитьYou forgot an exit after your bind check. Now it will still go into the loop.
Ugh the receive call returns a pointer to data?! That is a daft implementation. You would want to pass a point to a data block, Because now you need to free the pointer to the data after everything call.
Otherwise when you pass in a data pointer you would just free it after your client is done. This returning of a data pointer is not very C-like.
I sure love binding to tcp://localhorse:5555
ОтветитьHi, wouldn't the zsock_destroy function in server.c never be called ? Wouldn't it be better to setup a function whenever a SIGINT is received that destroys the socket and terminate the server ?
Ответитьcool but what if we need to serve 1000 clients asynchronously? maybe io_uring (liburing) will help?
ОтветитьThanks man, awesome vid.
I've just started to use this library to deploy C code directly to a Raspberry Pi robot of mine.
it's super useful. Keep Rocking \m/
Does this shit work on Zig too?
ОтветитьNahh, I’ll just stick to sockets, plus it’s not doing a lot of abstraction, still bind and connect, what if u wanna use UDP instead of TCP !! though I really loved the way how it giving a warning about the not freed socket.
Ответитьcool
Ответить