Questions tagged [unix-socket]

UNIX domain sockets are a technology for interprocess communication on a single computer.

UNIX domain sockets are a technology for interprocess communication on a single computer. They allow processes on the same machine to establish bidirectional connections to exchange either continuous byte streams or datagram messages.

The API is in many places the same as the one used for TCP/IP network sockets. A UNIX domain socket listening for connections may be represented as an inode in the file system, depending on the operating system and the parameters used to bind that socket.

Unix Domain Sockets can only communicate within a Linux OS kernel, they can not communicate externally to a kernel.

Details are provided in the unix(7) man page.

699 questions
0
votes
4 answers

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…
Amita
  • 11
  • 2
0
votes
1 answer

The poll() function returns a non-zero positive value with no events from the sockets i have registered for

This continues to occur for an infinite amount of time until a valid event occurs on the corresponding socket. Then again, it goes back to normal behavior. Unable to trace the trigger for this issue. What other events should I look for in the…
b1tchacked
  • 468
  • 4
  • 12
0
votes
2 answers

use gethostbyname() to find IP

what is the correct way to use gethostbyname() in c to retrive the real ip address of the host. Also why would people say DHCP would put this approach in potential danger ?
yuan
  • 317
  • 1
  • 4
  • 12
0
votes
1 answer

Can unix domain sockets be used to send file descriptors between processes when used in connectionless mode?

Basically, I'm wondering whether I can mix this with this. Use case is that I'm designing a multi-process server in which the worker processes must be able to send file descriptors to another, specific (depends on the fd) worker process, and I don't…
Bwmat
  • 4,314
  • 3
  • 27
  • 42
0
votes
3 answers

Unix Socket sending/receiving long messages

I am writing a simple application layer protocol using tcp and I encounter a problem. I want to make fragmentation in message sending because messages are so long. But I cannot synchronize the process and the client reads empty buffer before the…
Erkan Erol
  • 1,334
  • 2
  • 15
  • 32
0
votes
1 answer

What is the correct way to listen to both UDS and TCP sockets in a `fork()` based server?

I'm writing a fork() based server, the TCP sockets are the communication channel of the clients with the server and the UDS socket (datagram, if it makes any difference) is the communication channel of a management console with the server. What…
Quaker
  • 1,483
  • 3
  • 20
  • 36
0
votes
1 answer

PDO Fatal error: Call to a member function prepare() on a non-object (using classes)

I am receiving the following error when loading my index page: Fatal error: Call to a member function prepare() on a non-object in /Applications/MAMP/htdocs/parse/helloworld/helloworld/libraries/Database.php on line 32 I will place all of the…
Mazzone
  • 401
  • 1
  • 6
  • 21
0
votes
0 answers

What can cause `recvfrom()` not to set

So I'm using Unix Domain Socket (datagram) to communicate between two processes on my machine. The client sends queries to the server which is making some calculations and returns the result to the client. My server receives queries from the client…
Quaker
  • 1,483
  • 3
  • 20
  • 36
0
votes
0 answers

Python - Use an Unix socket which already exists

I run a Python program on an embedded system. This system runs a server that creates UNIX sockets. def com(request): my_socket = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) my_socket.connect("/var/run/.json-cgi") …
alexis.
  • 13
  • 1
  • 7
0
votes
0 answers

How to use python or perl to write unix dgram socket client?

A unix dgram socket server has already been created. How to use python or perl to write a client? Below code is not working, returns "Connection refused". (python 2.7.6) #!/usr/bin/python import socket import os, os.path path =…
ptan
  • 169
  • 3
  • 9
0
votes
1 answer

Unix domain socket : sending file descriptor and select()

I have seen these question on descriptor passing on SO. Descriptor passing with unix domain sockets Sending file descriptor over UNIX domain socket, and select() i wrote following two programs to work with Unix domain socket main program…
sonus21
  • 5,178
  • 2
  • 23
  • 48
0
votes
2 answers

Handling recv of Random Data Sizes In no-block Mode

I'm sure this question has been asked before, and maybe it's just somewhere miles and miles hidden somewhere in Google results or Stackoverflow. But so far I've setup a nonblocking cache server. That does well with small messages or data. But what…
ajm113
  • 936
  • 1
  • 8
  • 18
0
votes
1 answer

Unix network programming /socket programming

I get the following error In function w_Endline: /home/prog2/in_out.c:113:19: error: assignment of read-only l ocation ‘*(sent + (sizetype)(endlen * 1ul))’ sent[endlen]='\0'; /home/prog2/in_out.c: In function…
BDS
  • 97
  • 1
  • 1
  • 9
0
votes
1 answer

Not able to connect to socket using socat

I am trying to parse rsyslog logs. For this i am sending all my logs to socat which is then sending them to Unix Domain Socket. That socket is created via perl script which is listening on that socket to parse logs. My bash script to which rsyslog…
shivams
  • 2,597
  • 6
  • 25
  • 47
0
votes
1 answer

Unreliable http client despite polling file descriptor

I am trying to write a simple HTTP client in OCaml. I understand that it would be easier to use a library like cohttp, etc. I am doing this for my own sake, so no need to make the suggestion. Here is my code. module Connection = struct let…
eatonphil
  • 13,115
  • 27
  • 76
  • 133