You can use socket functions (fsockopen() and related) on any free hosting account. However, the access is limited to prevent abuse.
A small set of default ports are available for sockets. This means functions like SMTP, FTP and requests to external websites work fine. However, more specialized ports, like game server ports, are not available. Additional ports cannot be opened on request.