Hello, instead of making a socket from scratch you can use the alternative is IO::Socket::INET which gives you a nice scalar reference that you can call some methods on to make reading and things easier. good luck!

Thanks for your repy! So, you showed me how to make a TCP socket at 0.0.0.0 port 9999. That helps, but I was wondering how I would use IO::Async or AnyEvent or some other event driven module to automagically have data echoed back or printed to the screen when something gets sent to the socket. In particular, I wanted to use a RAW socket, and I have not seen a lot of documentation on using raw sockets. Here is some pseudocode:

Something like that would be ideal. I thought IO::Async or AnyEvent would make for a nice substitute for the fictitious My::MagicEventBasedModule. As you can see in the pseudocode, I associated a subroutine with a point at which $my_event_loop_handler_thing detects the filehandler to have data that could be read. In my pseudocode, the subroutine is passed the data along with the source address and port that sent it. That would be nice, but all I really need is the data. The raw IP packet would contain all the information I would need. Actually I would just encode it in hex and pass it over XMPP to the other computer, which would decode it and feed it to its raw socket at 0.0.0.0. Then the process would start again as the other computer replies. For now, I just need to know how to use an event based module to print raw data from a raw socket to the screen every time data is sent to the socket. The reason I want it to be event based is so I am not explicitly assigning threads and/or processes to constantly check the socket and the XMPP client for new data and messages respectively.

A truly raw socket listens at the ethernet level, which is not something IO::Socket::INET does (which works at the IP-level, which gives you the choices for protocols TCP, UDP or ICMP).
For raw sockets, you will have to use Socket.
Edit: Raw sockets cannot be bound to an IP.