unix-socket

How can I map a local unix socket to an inet socket?

I'm curious if it is possible to map a UNIX socket on to an INET socket. The situation is simply that I'd like to connect to a MySQL server. Unfortunately it has INET sockets disabled and therefore I can only connect with UNIX sockets. The tools I'm using/writing have to connect on an INET socket, so I'm trying to see if I can map one on...

ruby socket dgram example

I'm trying to use unix sockets and SOCK_DGRAM in ruby, but am having a really hard time figuring out how to do it. So far, I've been trying things like this: sock_path = 'test.socket' s1 = Socket.new(Socket::AF_UNIX, Socket::SOCK_DGRAM, 0) s1.bind(Socket.pack_sockaddr_un(sock_path)) s2 = Socket.new(Socket::AF_UNIX, Socket::SOCK_DGRAM,...

Reading / Writing from a Unix Socket in Ruby

I'm trying to connect, read and write from a UNIX socket in Ruby. It is a stats socket used by haproxy. My code is the following: require 'socket' socket = UNIXSocket.new("/tmp/haproxy.stats.socket") # First attempt: works socket.puts("show stat") while(line = socket.gets) do puts line end # Second attemp: fails socket.puts("sho...

Porting Windows socket program to Unix: Alternative for winsock32 APIs in unix

In Socket Programming, how will a Unix thread receive a Socket CLOSE event from a client if connection is closed? Are there any API's which will notify the unix thread about the CLOSE event received? As in Windows we have WSAEnumNetworkEvents API which gets the event notification for a specified socket descriptor. What will be the equi...

So setsockopt for timeouts on AF_UNIX (AF_LOCAL) sockets... undocumented/don't work... options/alternatives?

I'm running Fedora 13 if that matters. I looked up man pages on unix(7), setsockopt, and send/recv. Reading the man pages seems to more or less tell me that not all options are guaranteed to do ANYTHING... and apparently only a few that do/don't work are actually documented. In particular... I wanted to see if timeouts were possible. ...

Unix socket connection to MySql with Java to avoid JDBC's TCP/IP overhead?

Is it possible to make a Unix socket connection to MySql with Java to avoid JDBC's TCP/IP overhead? Does anyone know a library (or a few libraries, perhaps) that makes this possible? ...