I'm trying to set up a simple server that just receives messages
(not threaded). So, i have written
/* for port allocation */
ipc_space_t ist;
kern_return_t port_err;
mach_port_t name;
task_t self;
/* for message reception */
mach_msg_return_t msg_err;
mach_msg_header_t msg_body;
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.
Secondly, how can a client discover this server's port in order to
send something?
Any help is appreciated!
Thanks,
Constantine
_______________________________________________
Bug-hurd mailing list
Bug-hurd@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-hurd