Web Roles and Worker Roles are essentially Windows Server 2008 SP2/R2 with and without IIS running, respectively. As for code, do whatever you'd do in Windows Server to listen on a particular port.
A port maps to a specific role. So, if you have a Web role and create an input endpoint on port 293, then that traffic would be directed to your Web Role (and load-balanced across all instances). Likewise, if you set up the port on a Worker Role, the traffic would go to instances of the Worker Role.
If your socket listener is actually going to save data that's being uploaded, you need to make sure your saved data goes to durable storage - that is, to Windows Azure blobs or tables, or SQL Azure. If you write to a local disk (including disk local disk space allocated as a Local Resource), it's non-durable and you cannot count on data sticking around if something goes wrong (e.g. disk failure).