version 1.3, 2000/01/13 07:57:09 |
version 1.4, 2000/10/10 05:23:20 |
|
|
/* -*- mode: C; coding: euc-japan -*- */ |
/* -*- mode: C; coding: euc-japan -*- */ |
/* $OpenXM: OpenXM/src/ox_toolkit/mysocket.c,v 1.2 2000/01/05 06:05:35 ohara Exp $ */ |
/* $OpenXM: OpenXM/src/ox_toolkit/mysocket.c,v 1.3 2000/01/13 07:57:09 ohara Exp $ */ |
/* |
/* |
Q: How to get a local port number? |
Q: How to get a local port number? |
A: You do setsockopt() to set options and do socket(), bind(). |
A: You do setsockopt() to set options and do socket(), bind(). |
|
|
#include <unistd.h> |
#include <unistd.h> |
#include <errno.h> |
#include <errno.h> |
#include <netdb.h> |
#include <netdb.h> |
|
#include <string.h> |
#include <netinet/in.h> |
#include <netinet/in.h> |
#include <sys/types.h> |
#include <sys/types.h> |
#include <sys/socket.h> |
#include <sys/socket.h> |
Line 41 static int getsocket(struct sockaddr_in *mp, char *hos |
|
Line 42 static int getsocket(struct sockaddr_in *mp, char *hos |
|
|
|
int mysocketAccept(int s_waiting) |
int mysocketAccept(int s_waiting) |
{ |
{ |
int val = accept(s_waiting, NULL, NULL); |
return accept(s_waiting, NULL, NULL); |
return val; |
|
} |
} |
|
|
int mysocketListen(char *hostname, short *portp) |
int mysocketListen(char *hostname, short *portp) |