use Socket; $proto = getprotobyname('udp'); socket(Socket_Handle, PF_INET, SOCK_DGRAM, $proto); $iaddr = gethostbyname('hishost.com'); $port = getservbyname('time', 'udp'); $sin = sockaddr_in($port, $iaddr); send(Socket_Handle, 0, 0, $sin); $proto = getprotobyname('tcp'); socket(Socket_Handle, PF_INET, SOCK_STREAM, $proto); $port = getservbyname('smtp'); $sin = sockaddr_in($port, inet_aton("127.1")); $sin = sockaddr_in(7, inet_aton("localhost")); $sin = sockaddr_in(7, INADDR_LOOPBACK); connect(Socket_Handle, $sin); ($port, $iaddr) = sockaddr_in(getpeername(Socket_Handle)); $peer_host = gethostbyaddr($iaddr, AF_INET); $peer_addr = inet_ntoa($iaddr); $proto = getprotobyname('tcp'); socket(Socket_Handle, PF_UNIX, SOCK_STREAM, $proto); unlink('/tmp/usock'); $sun = sockaddr_un('/tmp/usock'); connect(Socket_Handle, $sun);