[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
mach_msg trouble
From: |
Constantine Kousoulos |
Subject: |
mach_msg trouble |
Date: |
Thu, 23 Nov 2006 21:31:27 +0200 |
User-agent: |
Icedove 1.5.0.7 (X11/20061013) |
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
- mach_msg trouble,
Constantine Kousoulos <=