Skip to content

Error code: -9993(0x-2709), Invalid argument #208

@kkharji

Description

@kkharji

I'm having an odd issue that I can't seem to be able to solve.

In my program I have a main unix socket that accept message and within the same program I have cli that create a socket and write to the main socket. The connection to main has no issues, it's when I write, the main socket error out with Error code: -9993(0x-2709), Invalid argument

Main Socket:

  func attach() async {
    do {
      try socket.listen(on: socketPath)
      log.info("Listening on \(socketPath)")
      while true {
        let socket = try Socket.create(family: .unix, type: .stream, proto: .unix) 
        let conn = try socket.acceptClientConnection()
        let msg = try conn.readString()?.trimmingCharacters(in: .whitespacesAndNewlines)
        conn.close()
       // await .......
      }
    } catch { log.error("Socket error: \(error)")  }
  }

CLI socket write:

do {
  let socket = try Socket.create(family: .unix, type: .stream, proto: .unix)
  try socket.connect(to: socketPath)
  try socket.write(from: "-d restart")
  return
} catch { ... }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions