|
-
June 4th, 2003, 10:37 PM
#1
Sockets and EOF Question
Trying to get my head around the idea of eof in sockets. Its the concept I want help with not the code.
If I conect a socket to my localhost mail server. Now say I send the command help. The server obviously responds with mutiple lines of data. I need to get all this data into a buffer before I can send more commands.
So I read examples and they all seem to use a loop and test for the EOF, and if EOF is reached then the loop breaks and they send more commands. So all data can be recieved.
Now I have tryed this with a function called feof which tests the socket handle for EOF. But i have noticed there is never an EOF.
Is there not suposed to be a EOF at the end of each line of server responce?
Here is a hex dump from my responces i got:
32 32 30 20 41 72 47 6f 53 6f 66 74 20 4d 61 69 6c 20 53 65 72 76 65 72 20 46 72 65 65 77 61 72 65 2c 20 56 65 72 73 69 6f 6e 20 31 2e 38 20 28 31 2e 38 2e 33 2e 34 29 0d 0a 32 35 30 20 57 65 6c 63 6f 6d 65 20 20 5b 31 32 37 2e 30 2e 30 2e 31 5d 2c 20 70 6c 65 61 73 65 64 20 74 6f 20 6d 65 65 74 20 79 6f 75 0d 0a
And this is what it looked like:
220 ArGoSoft Mail Server Freeware, Version 1.8 (1.8.3.4)
250 Welcome [127.0.0.1], pleased to meet you
See how each line ends in CR LF 0d 0a
But this is not a EOF corect?
Can someone explain how looping for EOF would let me grab all lines?
The above responce is not the problem, just to show what my lines end in CR LF, but if I did for example HELP then just fgets does not grab all lines only one,
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|