[Gd-chatter] [Bug 7345] New: udp-server-socket doesn't work [at least on linux, have to check on windows]
bugzilla-daemon at gwydiondylan.org
bugzilla-daemon at gwydiondylan.org
Sun Mar 18 19:15:42 CET 2007
http://www.gwydiondylan.org/cgi-bin/bugzilla/show_bug.cgi?id=7345
Summary: udp-server-socket doesn't work [at least on linux, have
to check on windows]
Product: OpenDylan
Version: OD 1.0 beta 2
Platform: All
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P2
Component: Libraries/Network
AssignedTo: hannes at mehnert.org
ReportedBy: hannes at mehnert.org
CC: gd-chatter at gwydiondylan.org
generating a udp-server-socket always results in a socket error.
A workaround is the following code:
define method toplevel (udp-collector :: <udp-collector>)
let fd = socket($PF-INET, $SOCK-DGRAM, 0);
with-stack-structure (sockaddr :: <sockaddr-in*>)
sockaddr.sin-family-value := $PF-INET;
sockaddr.sin-port-value := htons(2342);
sockaddr.sin-addr-value := $INADDR-ANY;
if (bind(fd, sockaddr, size-of(<sockaddr-in>)) == -1)
format-out("Couldn't bind\n");
end if;
end;
local method unix-receive ()
let buffer = make(<buffer>, size: 2048);
let read-bytes
= interruptible-system-call(unix-recv-buffer(fd,
buffer-offset(buffer, 0),
2048,
0));
if (read-bytes == -1)
//Only want to catch $EINTR, but getting mps assertion failures
//unix-receive();
#f
else
copy-sequence(buffer, end: read-bytes);
end if;
end method;
while(#t)
let buffer = unix-receive();
if (buffer)
let obs = transform-sputnik-datagram(udp-collector,
parse-frame(<sputnik-udp-frame>,
buffer));
if (obs) udp-collector.push-closure(obs) end;
end;
end;
end;
--
Configure bugmail: http://www.gwydiondylan.org/cgi-bin/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
More information about the chatter
mailing list