#What I am ultimately trying to accomplish:
My ultimate goal is to forward everything that a raw socket picks up at 0.0.0.0 over an XMPP chat line get another computer to receive the data and pass it on to its 0.0.0.0 address via another raw socket. I almost had it in python using an IRC, but found that IRCs do not like long messages or many short ones. XMPP servers seem to be less restrictive so I was hoping the system would work with one of those. I decided to switch from Python to Perl after evaluating all the socket management and XMPP client modules for a number of scripting languages. After attempting this in a number of scripting languages, I have learned to come pretty close to my final goal by starting with an XMPP (or IRC) echo bot and a socket server that prints data to the screen and/or sends it back to the source. In the past I used TCP, but I am switching to raw sockets for a number of reasons that are not important for this particular question.
#What I would like to be able to do first:
For the time being, I have been trying to learn to set up a raw socket, bind it to address 0.0.0.0, and have it print everything it receives in an event driven manner. I assumed this would mean using IO::Async or AnyEvent. I found that AnyEvent does not like raw sockets because they are "not streams" or something, so I was trying to use IO:Async. However, I am not very familiar with Perl, and I honestly have just been trying to hash together example codes so I can study something. I cannot imagine this is very hard to do, but for some reason I cannot figure out how to do it.
#What am asking of anyone who would be willing to help:
I would really appreciate some example codes that use raw sockets. Something that prints the raw data to the screen and/or echos it back to the sender would be great. From there, I need to learn how to set up an event driven echo bot for XMPP in Perl. Once I have those, I already know how I want to combine them into something that transmits data over a chatline because I have done similar things in other scripting languages.
Thanks
In reply to Printing data from a raw socket to the screen and/or echoing it back via event driven means by Feynman
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |