Vegastrike 0.5.1 rc1  1.0
Original sources for Vegastrike Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
inet_file.h File Reference

Go to the source code of this file.

Functions

bool fNET_BytesToRead (int socket)
 
bool fNET_Read (int socket, char *data, int bytestoread)
 
int fNET_Recv (int socket, char *data, int bytestoread)
 
int fNET_Write (int socket, int bytestowrite, const char *data)
 
int fNET_listen (unsigned short port, const char *addr=NULL)
 
int fNET_Accept (int hServerSocket)
 
int fNET_AcceptFrom (unsigned short port, const char *addr=NULL)
 
int fNET_ConnectTo (const char *hostname, unsigned short port)
 
char fNET_fgetc (int socket)
 
void fNET_close (int socket)
 
void fNET_startup ()
 
void fNET_cleanup ()
 

Function Documentation

int fNET_Accept ( int  hServerSocket)

Definition at line 112 of file inet_file.cpp.

113 {
114  return -1;
115 }
int fNET_AcceptFrom ( unsigned short  port,
const char *  addr = NULL 
)

Definition at line 116 of file inet_file.cpp.

Referenced by main().

117 {
118  return -1;
119 }
bool fNET_BytesToRead ( int  socket)

Definition at line 39 of file inet_file.cpp.

Referenced by my_bytestoread().

40 {
41  /*
42  * char c;
43  * if (read (socket,&c,1)==1) {
44  * printf ("read %c",c);
45  * printf ("seekin %d",lseek (socket,SEEK_CUR,-1));
46  *
47  * return true;
48  * }
49  * return false;
50  */
51 
52  off_t curpos = lseek( socket, SEEK_CUR, 0 );
53  off_t endpos = lseek( socket, SEEK_END, 0 );
54  if (curpos+1 != endpos) {
55  lseek( socket, SEEK_SET, curpos );
56  return true;
57  }
58  return false;
59 }
void fNET_cleanup ( )

Definition at line 97 of file inet_file.cpp.

Referenced by main(), and Music::~Music().

97 {}
void fNET_close ( int  socket)

Definition at line 60 of file inet_file.cpp.

Referenced by main(), and Music::~Music().

61 {
62  close( socket );
63 }
int fNET_ConnectTo ( const char *  hostname,
unsigned short  port 
)

Definition at line 108 of file inet_file.cpp.

109 {
110  return -1;
111 }
char fNET_fgetc ( int  socket)

Definition at line 91 of file inet_file.cpp.

References fNET_Recv().

Referenced by main(), my_getchar(), and Muzak::readerThread().

92 {
93  char myc = '\0';
94  fNET_Recv( socket, &myc, sizeof (char) );
95  return myc;
96 }
int fNET_listen ( unsigned short  port,
const char *  addr = NULL 
)

Definition at line 104 of file inet_file.cpp.

105 {
106  return -1;
107 }
bool fNET_Read ( int  socket,
char *  data,
int  bytestoread 
)

Definition at line 73 of file inet_file.cpp.

References micro_sleep.

74 {
75  int bytes_read = 0;
76  int ret;
77  while (bytes_read < bytestoread) {
78  ret = read( socket, data+bytes_read, bytestoread-bytes_read );
79  if (-1 == ret)
80  return false;
81  bytes_read += ret;
82  if (!ret) micro_sleep( 50000 );
83  }
84  return true;
85 }
int fNET_Recv ( int  socket,
char *  data,
int  bytestoread 
)

Definition at line 64 of file inet_file.cpp.

References micro_sleep.

Referenced by fNET_fgetc().

65 {
66  int retval = 0;
67  while (retval == 0) {
68  retval = read( socket, data, bytestoread );
69  if (!retval) micro_sleep( 50000 );
70  }
71  return retval;
72 }
void fNET_startup ( )

Definition at line 98 of file inet_file.cpp.

Referenced by main(), and Music::Music().

98 {}
int fNET_Write ( int  socket,
int  bytestowrite,
const char *  data 
)

Definition at line 87 of file inet_file.cpp.

Referenced by F0rkProcess(), ForwardBytes(), Music::Music(), music_finished(), and Music::~Music().

88 {
89  return write( socket, data, bytestowrite );
90 }