From: yan cui <ccuiyyan@gmail.com>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: Re: [9fans] [GSOC] Dial between two computers
Date: Mon, 26 May 2014 20:08:41 -0400 [thread overview]
Message-ID: <CAAVq3rkBnb=dahbn1GyKDO0ieSOxZraeYtjPnqGo5uu1sq8EPQ@mail.gmail.com> (raw)
In-Reply-To: <CAAVq3r=Cm+1A3yg147=hhhZdQsz7toXhG3PMFBSsvqtysVuEOA@mail.gmail.com>
[-- Attachment #1.1: Type: text/plain, Size: 936 bytes --]
dial.c has been attached.
2014-05-26 20:06 GMT-04:00 yan cui <ccuiyyan@gmail.com>:
> Hi all,
>
> I used a program to dial from one system to another system, but
> it gives a connection time out error. I have searched on Internet for a
> long time and cannot get a solution. Could you please provide some
> suggestions or hints? Basically, one system is Linux based system with rc
> shell installed (we call it A). The other one is a auth+cpu+file server
> (we call it B). On B, I have used fossil/conf command to listen tcp!*!564.
> On A, I executed dial tcp!<B's ip address>!564, but it reports a time out
> error after waiting some time. Results are the same when A is a plan9
> terminal. By the way, I can ping A to B successfully. What could be the
> possible problems?
>
>
> Thanks, Yan
>
> --
> Think big; Dream impossible; Make it happen.
>
--
Think big; Dream impossible; Make it happen.
[-- Attachment #1.2: Type: text/html, Size: 1606 bytes --]
[-- Attachment #2: dial.c --]
[-- Type: text/x-csrc, Size: 879 bytes --]
#include <u.h>
#include <libc.h>
void
usage(void)
{
fprint(2, "usage: dial [-e] addr\n");
exits("usage");
}
void
killer(void *x, char *msg)
{
USED(x);
if(strcmp(msg, "kill") == 0)
exits(0);
noted(NDFLT);
}
void
main(int argc, char **argv)
{
int fd, pid;
char buf[8192];
int n, waitforeof;
notify(killer);
waitforeof = 0;
ARGBEGIN{
case 'e':
waitforeof = 1;
break;
default:
usage();
}ARGEND
if(argc != 1)
usage();
if((fd = dial(argv[0], nil, nil, nil)) < 0)
sysfatal("dial: %r");
switch(pid = fork()){
case -1:
sysfatal("fork: %r");
case 0:
while((n = read(0, buf, sizeof buf)) > 0)
if(write(fd, buf, n) < 0)
break;
if(!waitforeof)
postnote(PNPROC, getppid(), "kill");
exits(nil);
}
while((n = read(fd, buf, sizeof buf)) > 0)
if(write(1, buf, n) < 0)
break;
postnote(PNPROC, pid, "kill");
waitpid();
exits(0);
}
next prev parent reply other threads:[~2014-05-27 0:08 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-27 0:06 yan cui
2014-05-27 0:08 ` yan cui [this message]
2014-05-27 0:13 ` Nick Owens
2014-05-27 0:52 ` Skip Tavakkolian
2014-05-27 1:30 ` yan cui
2014-05-27 1:51 ` Skip Tavakkolian
2014-05-27 2:18 ` yan cui
2014-05-27 2:26 ` Skip Tavakkolian
2014-05-27 2:37 ` yan cui
2014-05-27 3:02 ` Bakul Shah
2014-05-27 3:28 ` yan cui
2014-05-27 4:01 ` 有澤 健治
2014-05-27 3:49 ` yan cui
2014-05-27 4:01 ` Skip Tavakkolian
2014-05-27 16:03 ` yan cui
2014-05-27 1:20 ` yan cui
2014-05-27 12:38 ` erik quanstrom
2014-05-27 15:18 ` Skip Tavakkolian
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='CAAVq3rkBnb=dahbn1GyKDO0ieSOxZraeYtjPnqGo5uu1sq8EPQ@mail.gmail.com' \
--to=ccuiyyan@gmail.com \
--cc=9fans@9fans.net \
/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).