This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Hihihi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(Originally written in 2009 and posted to livejournal!! https://jdimpson.livejournal.com/6534.html) | |
I'm not the only person who has a socat tutorial, but I think this post is unique because it will attempt to describe socat by comparing it to a tool that is doubtless a major inspiration for socat, namely, netcat. Hopefully, it will clarify how to use socat, demonstrate how much more featureful socat is, but also show why you shouldn't go ahead and delete netcat outright. | |
But before we compare socat to netcat, let's compare it to their common namesake, cat. | |
Use cat to display a file on standard output. | |
jdimpson@artoo:~$ cat file.txt | |
This is the content of file.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(originally written in 2009 and posted to livejournal! https://jdimpson.livejournal.com/6812.html | |
The last article teaches how to use socat by comparing it first to cat then to netcat. It skimped on socat's UDP-related features, because netcat only implements a subset of them. This article picks up where the last one left off, with respect to UDP. After this article will be one more that discusses advanced socat features. | |
It turns out there are a lot of subleties when dealing with UDP, even before multicast is mixed in. We'll abandon the comparisons to netcat, as we've exceeded what netcat can do. But first a quick reminder of one way socat does UDP. | |
socat as a UDP server on port 11111. | |
socat STDIO UDP-LISTEN:11111 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# Basic gist to download a dang recipe from Wegmans grocery store, | |
# hardcoded for https://shop.wegmans.com/recipes/3883/black-bean-enchiladas | |
# I used a fresh firefox instance so while these cookies probably contain unique/identifying information, | |
# they aren't representative of me. | |
# If you've used their site, you know how customer-hostile it is, and if you are into cooking, you've been | |
# frustrated by an inability to just "save-as" their recipes. The actually put the recipes ingredients and directions in | |
# an API, so this code accesses that. |