
|
IOClass Class ReferenceInheritance diagram for IOClass:
[legend]Collaboration diagram for IOClass:
[legend]List of all members.
Detailed Description
Definition at line 1 of file IOClass.cpp.
Constructor & Destructor Documentation
IOClass::IOClass |
( |
|
) |
[inline] |
|
Member Function Documentation
void IOClass::read_text |
( |
char * |
, |
|
|
int * |
|
|
) |
[virtual] |
|
|
Implements ParserIO.
Definition at line 21 of file IOClass.cpp.
References parser, and socket. 00022 {
00023 fd_set rfds;
00024 int n;
00025
00026 FD_ZERO(&rfds);
00027 FD_SET(socket, &rfds);
00028 n = select(socket + 1, &rfds, NULL, NULL, NULL);
00029 if (n == -1)
00030 {
00031 perror("select() failed");
00032 parser -> m_next_line = NULL;
00033 return;
00034 }
00035 else
00036 if (!n)
00037 {
00038 printf("select() returns 0 (?)\n");
00039 parser -> m_next_line = NULL;
00040 return;
00041 }
00042 if (FD_ISSET(socket, &rfds))
00043 {
00044 *l = read(socket, s, *l);
00045 if (*l == -1)
00046 {
00047 perror("read() failed");
00048 parser -> m_next_line = NULL;
00049 }
00050 else
00051 if (*l == 0)
00052 {
00053 parser -> m_next_line = NULL;
00054 }
00055 else
00056 {
00057 printf("read() returns %d\n",*l);
00058 while (s[strlen(s) - 1] == 13 || s[strlen(s) - 1] == 10)
00059 s[strlen(s) - 1] = 0;
00060 }
00061 }
00062 else
00063 {
00064 printf("socket did not release select() call\n");
00065 parser -> m_next_line = NULL;
00066 }
00067 }
|
void IOClass::set_parser |
( |
Parser * |
p |
) |
[inline] |
|
void IOClass::set_socket |
( |
int |
s |
) |
[inline] |
|
void IOClass::write_text |
( |
char * |
, |
|
|
int |
|
|
) |
[virtual] |
|
|
Implements ParserIO.
Definition at line 69 of file IOClass.cpp.
References socket. 00070 {
00071 if (write(socket, s, l) == -1)
00072 {
00073 perror("write() failed");
00074 }
00075 }
|
Member Data Documentation
The documentation for this class was generated from the following file:
|