removed EXOS_IPC udp io code
This commit is contained in:
parent
4c98c1d8a3
commit
47d4bee632
|
|
@ -18,7 +18,6 @@
|
|||
|
||||
#define SAVE_ERRNO(A) { int sav; sav = errno; A; errno = sav; }
|
||||
|
||||
#ifndef EXOS_IPC
|
||||
#include <netdb.h>
|
||||
#include <netinet/in.h>
|
||||
|
||||
|
|
@ -100,72 +99,4 @@ int _x_select (fd_set * rf, long tt) /* tt is in unit of ms */
|
|||
|
||||
return(select(FD_SETSIZE, rf, NULL, NULL , (struct timeval *) 0));
|
||||
}
|
||||
#endif /* not EXOS_IPC */
|
||||
|
||||
#ifdef EXOS_IPC
|
||||
|
||||
extern long rhost();
|
||||
|
||||
int _x_udp PROTO1(int *, port)
|
||||
{
|
||||
struct sockaddr_in sin; int f;
|
||||
|
||||
sin = INET_ZERO;
|
||||
sin.sin_family = AF_INET;
|
||||
sin.sin_port = htons((unsigned short) *port);
|
||||
if((f = socket(SOCK_DGRAM, (struct sockproto *) 0, &sin,
|
||||
SO_REUSEADDR)) == -1)
|
||||
return(-1);
|
||||
sin = INET_ZERO;
|
||||
if(socketaddr(f,&sin) == -1) {
|
||||
SAVE(((void) close(f)));
|
||||
return(-1);
|
||||
}
|
||||
if(!*port) *port = ntohs((unsigned short) sin.sin_port);
|
||||
return(f);
|
||||
}
|
||||
|
||||
int _x_adr PROTO3(char *, host, int, port, struct sockaddr_in *, his)
|
||||
{
|
||||
char myhost[128];
|
||||
int f;
|
||||
|
||||
*his = INET_ZERO;
|
||||
if(!host) (void) gethostname(host = myhost,sizeof(myhost));
|
||||
|
||||
his->sin_family = AF_INET;
|
||||
his->sin_port = htons((unsigned short) port);
|
||||
|
||||
if((his->sin_addr.s_addr = rhost(&host)) == -1) return(-1);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
int _x_select PROTO2(unsigned int *, readfds, long, tt)
|
||||
{
|
||||
int code;
|
||||
long mask = *readfds;
|
||||
|
||||
if(tt & 0xc0000000) tt = 0x3fffffff;/* It does not like 0x7fffffff. */
|
||||
|
||||
code = select(DSIZE, &mask, (long *) 0, tt);
|
||||
|
||||
*readfds = mask;
|
||||
|
||||
return(code);
|
||||
}
|
||||
|
||||
int recvfrom PROTO6(int, s, char *, msg, int, len, int, flags,
|
||||
struct sockaddr_in *, from, int *, fromlen)
|
||||
{
|
||||
return(receive(s,from,msg,len));
|
||||
}
|
||||
|
||||
int sendto PROTO6(int, s, char *, msg, int, len, int, flags,
|
||||
struct sockaddr_in *, to, int *, tolen)
|
||||
{
|
||||
to->sin_family = AF_INET;
|
||||
return(send(s,to,msg,len));
|
||||
}
|
||||
|
||||
#endif /* EXOS_IPC */
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user