9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: andrey mirtchovski <andrey@lanl.gov>
To: 9fans@cse.psu.edu
Subject: [9fans] rudp
Date: Mon, 15 Apr 2002 08:58:23 -0600	[thread overview]
Message-ID: <20020415145704.7C64A19981@mail.cse.psu.edu> (raw)

Hi,

I'm trying to use rudp for testing purpouses around here, but I'm a
tad puzzled by the semantics.  All I want to do is fork once and have
one process connect and send a string (or many) to another using the
rudp protocol.

Ip(3) says that listen is not an option, so the only thing I do is
announce() on one side and connect() on the other.  Unfortunately it
doesn't seem to connect at all.  I looked at
/sys/src/cmd/ndb/dnudpserver.c but I think there should be a simpler
way of doing things...

Error reported on connect is:
can't connect: file does not exist(/net/MACHINE/clone)

where MACHINE is the host i'm connecting to (localhost)...

What am I doing wrong and where should I look for more documentation?

Thanx, Andrey

Oh, yes, obligatory code paste: this is how I'm trying to connect.


char *proto = "rudp";
char *port = "5557";
char *host = "ps1";
char adir[40];
char str[40] = "this is a test\n";
char data[8192];

void main() {
	int fd, fd2;


	switch (fork()) {
		case 0:
			sleep(5000);
			if((fd = dial(netmkaddr(proto, host, port), 0, 0, 0)) < 0) {
				perror("can't connect");
				exits("connect");
			}
			write(fd, str, strlen(str));
			exits(0);

		default:
			if((fd2 = announce(netmkaddr("*", proto, port), adir)) < 0) {
				perror("can't announce");
				exits("announce");
			}
			while(read(fd2, data, 8192) > 0)
				print("parent: %s\n", data);

			exits(0);
	}
}



             reply	other threads:[~2002-04-15 14:58 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-15 14:58 andrey mirtchovski [this message]
  -- strict thread matches above, loose matches on Subject: below --
2002-04-15 16:55 andrey mirtchovski
2002-04-15 15:31 rog
2002-04-15 15:21 Russ Cox
2001-09-10  1:46 presotto
2001-09-08 17:52 bwc
     [not found] <ehg@research.bell-labs.com>
2001-09-08 16:59 ` Eric Grosse
2001-09-10  1:33   ` Scott Schwartz
2001-09-10 18:58   ` Boyd Roberts
2001-09-08 15:48 Sam

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020415145704.7C64A19981@mail.cse.psu.edu \
    --to=andrey@lanl.gov \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).