version 1.16, 2005/07/03 11:08:54 |
version 1.17, 2020/10/06 11:33:47 |
|
|
/* $OpenXM: OpenXM/src/kan96xx/plugin/mytcpio.c,v 1.15 2004/11/23 05:28:19 takayama Exp $ */ |
/* $OpenXM: OpenXM/src/kan96xx/plugin/mytcpio.c,v 1.16 2005/07/03 11:08:54 ohara Exp $ */ |
#include <stdio.h> |
#include <stdio.h> |
#include <string.h> |
#include <string.h> |
#include <sys/types.h> |
#include <sys/types.h> |
|
|
#include <netdb.h> |
#include <netdb.h> |
#include <setjmp.h> |
#include <setjmp.h> |
#include <errno.h> |
#include <errno.h> |
|
#include <unistd.h> |
/* -lnsl -lsocket /usr/ucblib/libucb.a */ |
/* -lnsl -lsocket /usr/ucblib/libucb.a */ |
#include "ox_kan.h" |
#include "ox_kan.h" |
/* |
/* |
Line 35 FILE *TcpioError = NULL; |
|
Line 36 FILE *TcpioError = NULL; |
|
int OpenedSocket = 0; |
int OpenedSocket = 0; |
extern int Quiet; |
extern int Quiet; |
|
|
socketOpen(char *serverName,int portNumber) { |
int socketOpen(char *serverName,int portNumber) { |
static struct hostent *myhost; |
static struct hostent *myhost; |
static struct sockaddr_in me; |
static struct sockaddr_in me; |
static int s_waiting; |
static int s_waiting; |
Line 85 socketOpen(char *serverName,int portNumber) { |
|
Line 86 socketOpen(char *serverName,int portNumber) { |
|
} |
} |
|
|
|
|
socketAccept(int snum) { |
int socketAccept(int snum) { |
int s, news; |
int s, news; |
|
|
SET_TCPIOERROR; |
SET_TCPIOERROR; |
Line 107 socketAccept(int snum) { |
|
Line 108 socketAccept(int snum) { |
|
return(news); |
return(news); |
} |
} |
|
|
socketAcceptLocal(int snum) { |
int socketAcceptLocal(int snum) { |
int s, news; |
int s, news; |
struct sockaddr peer; |
struct sockaddr peer; |
int len; |
int len; |
Line 152 socketAcceptLocal(int snum) { |
|
Line 153 socketAcceptLocal(int snum) { |
|
} |
} |
|
|
/* It does not close the socket for listening. */ |
/* It does not close the socket for listening. */ |
socketAcceptLocal2(int snum) { |
int socketAcceptLocal2(int snum) { |
int s, news; |
int s, news; |
struct sockaddr peer; |
struct sockaddr peer; |
int len; |
int len; |
Line 220 int oxSocketSelect0(int fd,int t) { |
|
Line 221 int oxSocketSelect0(int fd,int t) { |
|
else return(0); |
else return(0); |
} |
} |
|
|
oxSocketMultiSelect(int sid[],int size,int t,int result[]) |
int oxSocketMultiSelect(int sid[],int size,int t,int result[]) |
{ |
{ |
int i,fd,p; |
int i,fd,p; |
fd_set readfds; |
fd_set readfds; |
Line 271 oxSocketMultiSelect(int sid[],int size,int t,int resul |
|
Line 272 oxSocketMultiSelect(int sid[],int size,int t,int resul |
|
} |
} |
|
|
|
|
socketConnect(char *serverName,int portNumber) { |
int socketConnect(char *serverName,int portNumber) { |
struct hostent *servhost; |
struct hostent *servhost; |
struct sockaddr_in server; |
struct sockaddr_in server; |
int socketid; |
int socketid; |
Line 294 socketConnect(char *serverName,int portNumber) { |
|
Line 295 socketConnect(char *serverName,int portNumber) { |
|
} |
} |
/* on=1; setsockopt(socketid,SOL_SOCKET,SO_REUSEADDR,&on,sizeof(on)); */ |
/* on=1; setsockopt(socketid,SOL_SOCKET,SO_REUSEADDR,&on,sizeof(on)); */ |
if (!Quiet) { |
if (!Quiet) { |
fprintf(TcpioError,"Trying to connect port %d, ip=%x\n",ntohs(server.sin_port),server.sin_addr); |
fprintf(TcpioError,"Trying to connect port %d, ip=%lx\n",ntohs(server.sin_port),(long) server.sin_addr.s_addr); |
} |
} |
if (connect(socketid,(struct sockaddr *)&server,sizeof(server)) == -1) { |
if (connect(socketid,(struct sockaddr *)&server,sizeof(server)) == -1) { |
errorMsg1s("cannot connect"); |
errorMsg1s("cannot connect"); |
Line 304 socketConnect(char *serverName,int portNumber) { |
|
Line 305 socketConnect(char *serverName,int portNumber) { |
|
return(socketid); |
return(socketid); |
} |
} |
|
|
socketConnectWithPass(char *servername,int port,char *pass) |
int socketConnectWithPass(char *servername,int port,char *pass) |
{ |
{ |
int fd; |
int fd; |
int m; |
int m; |