[RC5] Personal proxy

Peter Cordes peter at u24n61.hfx.eastlink.ca
Sat Dec 25 01:30:51 EST 1999



On Wed, 22 Dec 1999, Jerome Lamarque wrote:
> 
> Yeah sure, and how are we supposed to install a personal proxy when 
> we only have Macs, BeBoxen and Amigas or other PowerPC based 
> computers?
> 
> I'd really like to know.

 If you run Unix (like Linux or *BSD) on any of your PPC boxes, it should
be easy to get a pproxy compiled for your system.  (This is just
speculation, but LinuxPPC is source compatible with other Linux ports, as
long as the program in question doesn't use any inline assembly or
platform-specific stuff (like devices).  I'd be surprised if there was
any non-portable stuff like that in the pproxy.)

 If not, maybe Be would be a good platform?  Any idea what kind of network
API it has?  (BSD-style sockets would be perfect, since it is widely
used.)  If you aren't a programmer, you can see what Be does seeing if
this compiles and runs.  You compile it with gcc, and run the binary, like
this: (in Be, you should pop open a Terminal, where you get a bash2 shell,
and gcc (if your Be system is anything like my friends which I had a few
minutes to check out).

llama:~/src/c/net$ gcc -Wall nettest.c -o nettest
llama:~/src/c/net$ ./nettest
socket: Success
socket() returned 3
us.v27.distributed.net => 205.149.163.211
Can create sockets and look up hostnames.  Your machine probably works :)

Here the source for nettest.c:

----- snip -------
#define _GNU_SOURCE

#include <stdio.h>

#include <netdb.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/socket.h>

int main( int argc, char ** argv ){
   
	int sock;
	struct hostent *server_info;
	char *server = "us.v27.distributed.net";

	sock = socket( PF_INET, SOCK_STREAM, 0 );
	perror( "socket" );
	printf( "socket() returned %d\n", sock );
	if( socket < 0 ){
		puts( "can't even create a socket :(");
		return 1;
	}

	server_info = gethostbyname( server );
	if( NULL == server_info ){
		herror( server );
		printf( "Couldn't find an IP address for %s :(\n", server );
		return 1;
	}

	printf( "%s => %s\n", server, 
		inet_ntoa( *(struct in_addr *) (server_info->h_addr) ) );

	puts( "Can create sockets and look up hostnames.  "
		"Your machine probably works :)" );

	return 0;
}
----------- snip -----------

(BTW, it looks line wrapped, but it isn't I line wrapped it on purpose, in
such a way that it isn't broken (in pine on an 80 character wide xterm :))

Hehe, if you are a C programmer yourself, then sorry for insulting your
intelligence.  :)  I know how obvious all the stuff I just said is to
those who know C.

 Anyway, if you run the program and it works right, then it should be
trivial to get a pproxy for Be, as long as you don't need it to lurk and
figure out when your net devices are up or not.  (That's part of the
platform-specific stuff.  Unix assumes that net connections are supposed
to be permanent, so there isn't really a standard interface for finding
out what's going on.)

 (disclaimer: I've never seen the code for the pproxy. :)   I'd be
surprised if I'm very far off the mark with most of this, though.

 Happy hacking, and merry Christmas to the Christians on this list :)

#define X(x,y) x##y
DUPS Secretary ; http://is2.dal.ca/~dups/
Peter Cordes ;  e-mail: X(peter at cordes.phys. , dal.ca)

"The gods confound the man who first found out how to distinguish the hours!
 Confound him, too, who in this place set up a sundial, to cut and hack
 my day so wretchedly into small pieces!" -- Plautus, 200 BCE

--
To unsubscribe, send 'unsubscribe rc5' to majordomo at lists.distributed.net
rc5-digest subscribers replace rc5 with rc5-digest



More information about the rc5 mailing list