version 1.1, 2005/11/12 02:38:01 |
version 1.2, 2005/11/12 05:21:28 |
|
|
/* $OpenXM$ |
/* $OpenXM: OpenXM/doc/oxlib/test1-tcp-rev.c,v 1.1 2005/11/12 02:38:01 takayama Exp $ |
/* A sample code to explain how to use ox_asir by TCP/IP and |
/* A sample code to explain how to use ox_asir by TCP/IP and |
OpenXM control protocol. ox_asir is called by the -revese option. |
OpenXM control protocol. ox_asir is called by the -revese option. |
It computes the gcd of 12 and 8 by calling ox_asir server. |
It computes the gcd of 12 and 8 by calling ox_asir server. |
*/ |
*/ |
|
|
#include <stdio.h> |
#include <stdio.h> |
|
#include <errno.h> |
#include <sys/types.h> |
#include <sys/types.h> |
#include <sys/socket.h> |
#include <sys/socket.h> |
#include <sys/time.h> |
#include <sys/time.h> |
|
|
if (fdStream == -1 || fdControl == -1) { |
if (fdStream == -1 || fdControl == -1) { |
fprintf(stderr,"\nOpen error in oxCreateClient2.\n"); |
fprintf(stderr,"\nOpen error in oxCreateClient2.\n"); |
fprintf(stderr,"fdStream=%d, fdControl=%d\n",fdStream,fdControl); |
fprintf(stderr,"fdStream=%d, fdControl=%d\n",fdStream,fdControl); |
return(NULL); |
return(0); |
} |
} |
|
|
/* Authentication by password. */ |
/* Authentication by password. */ |
|
|
fprintf(stderr,"s=%s, passControl=%s\n",s,passControl); |
fprintf(stderr,"s=%s, passControl=%s\n",s,passControl); |
fprintf(stderr,"password authentication failed for control channel.\n"); |
fprintf(stderr,"password authentication failed for control channel.\n"); |
close(fdControl); |
close(fdControl); |
return(NULL); |
return(0); |
} |
} |
m = strlen(passData); s[0] = 0; |
m = strlen(passData); s[0] = 0; |
read(fdStream,s,m+1); s[m] = '\0'; |
read(fdStream,s,m+1); s[m] = '\0'; |
|
|
fprintf(stderr,"s=%s, passData=%s\n",s,passData); |
fprintf(stderr,"s=%s, passData=%s\n",s,passData); |
fprintf(stderr,"password authentication failed for data channel.\n"); |
fprintf(stderr,"password authentication failed for data channel.\n"); |
close(fdStream); |
close(fdStream); |
return(NULL); |
return(0); |
} |
} |
} |
} |
|
|
Line 185 hoge(int dataPort) { |
|
Line 186 hoge(int dataPort) { |
|
#define SET_TCPIOERROR { if (TcpioError == NULL) TcpioError = stdout; } |
#define SET_TCPIOERROR { if (TcpioError == NULL) TcpioError = stdout; } |
FILE *TcpioError = NULL; |
FILE *TcpioError = NULL; |
int Quiet = 0; |
int Quiet = 0; |
extern int errno; |
|
errorMsg1s(char *s) { fprintf(stderr,"%s\n",s); } |
errorMsg1s(char *s) { fprintf(stderr,"%s\n",s); } |
socketAcceptLocal(int snum) { |
socketAcceptLocal(int snum) { |
int s, news; |
int s, news; |