bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: mach_msg trouble


From: Constantine Kousoulos
Subject: Re: mach_msg trouble
Date: Sat, 25 Nov 2006 10:32:17 +0200
User-agent: Icedove 1.5.0.7 (X11/20061013)

Constantine Kousoulos wrote:
... port_err=mach_port_allocate(mach_task_self(),
MACH_PORT_RIGHT_RECEIVE, &name);
  if (port_err!=KERN_SUCCESS)
    error(1, port_err, "cannot allocate port, %d", port_err);

  msg_err=mach_msg(&msg_body, MACH_RCV_MSG, 0, sizeof(msg_body),
            XXX,
            MACH_MSG_TIMEOUT_NONE,
            MACH_PORT_NULL);
  if (msg_err!=MACH_MSG_SUCCESS)
    error(1, msg_err, "error receiving message, %d", msg_err);

I don't know what to put instead of XXX to make this task
reveive messages at the allocated port.

I bypassed the previous problem using

mach_port_t rcv = mach_reply_port();
msg_err=mach_msg(&header, MACH_RCV_MSG, 0, sizeof(header),
                        rcv,
                        MACH_MSG_TIMEOUT_NONE,
                        MACH_PORT_NULL);


Secondly, how can a client discover this server's port in order to send something?


Let me explain a bit more and correct me if i am wrong. In order for two threads to communicate via mach_msg(), those two threads must belong to the same task. In order for a client program to communicate with an entirely different server program, mig or sockets are needed. When mig is used, how can i bind my server program to a specific port to listen for messages?


Thanks in any case,
Constantine






reply via email to

[Prev in Thread] Current Thread [Next in Thread]