I have created udpsvr.icn and udpcli.icn (see below).

I start udpsvr, either as root or as a normal user.
I run udpcli as a normal user.
udpsvr never writes anything to the console, and udpcli writes:
  successfully opened port, writing message
  wrote message, waiting for response
    [waits for two seconds, then writes]
  attempting to read response

(If I put a write statement after the open command in udpsvr.icn, 
udpsvr does write a message to the console.)

What am I doing wrong?

[unicorn@xmi-serve unicon]$ cat udpsvr.icn
global pgn

procedure main(argv)
  local f, r
  pgn := argv[0]||": "
  (f := open(":2842","nua")) |
    stop(pgn||"could not open UDP port to accept connections")
  while r := receive(f) do {
    write("message for you, Sir.  >>>----->")
    write(r.msg)
    send(r.addr, type(r.msg))|
      stop(pgn||"failed sending response on UDP port")
  }
end
[unicorn@xmi-serve unicon]$ cat udpcli.icn
global pgn

procedure main(argv)
  local f, r
  pgn := argv[0]||": "
  (f := open("localhost:2842","nu")) |
    stop(pgn, "could not make connection on UDP port.\n", &errortext)

  write( "successfully opened port, writing message")

  writes(f, "hello world")

  write( "wrote message, waiting for response")

  if *select(f, 2000) = 0 then {
    stop(pgn, "connection on UDP port timed out.\n", &errortext)
  }

  write( "attempting to read response" )

  r := receive(f) |
    stop(pgn, "receive failed on UDP port.\n", &errortext)

  write( "read response, attempting to extract msg" )

  write(r.msg) |
      stop(pgn, "failed writing r.msg received via UDP port.\n", &errortext)
end

_______________________________________________
Unicon-group mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/unicon-group

Reply via email to