ok im able to connect to a news server and recieve a '200' connection ok message. my next thing i would like to do is to get a list of newsgroups now.

im confused on how i should go about this. i sent the LIST command to retrieve the groups, but what do i do now? this is what i have:



invoke lstrlen, addr cmdLIST
invoke send, hSocket, addr cmdLIST, eax, 0
invoke GlobalAlloc, GHND, SizeOfRead
mov hMemory,eax
invoke GlobalLock, eax
mov pMemory, eax
invoke recv, hSocket, pMemory, SizeOfRead, 0
.if eax == SOCKET_ERROR
invoke MessageBox,0,pMemory,0,0 ;testing what i got back
.endif


i appear to be gettting a socket error. my messagebox appears.
so when i want someone thing from the server do i always send a command to it then on my end invoke recv?
Posted on 2002-01-06 16:08:28 by smurf
another question i have is whether or not im required to send a name and password. ive established a connection with a news server so in this situation i dont think ill need to is this correct or do i need to send a generic name and password still?
Posted on 2002-01-06 18:57:06 by smurf
hi smurf
One thing you should try is use telnet to connect to the news server and type in the commands so you can see what the responses are. I've never done a news reader but I think it only sends you data when you have sent a command so sending a command then doing receive would be the right thing to do unless you have changed it recv will wait untill there is some data before it returns so it should only return if you were disconnected.

EDIT
call WSAGetLastError to see what the error is. Also remember that the news server will send a reply of varying lenghth and the time it takes to complete all of the data transfer will depend on server load so look at the ioctlsocket function to check how much data is waiting to be received.
Posted on 2002-01-06 21:36:33 by Quantum
i sent the LIST command to retrieve the groups, but what do i do now?


I never actually used the NNTP protocol but I looked things up in the rfc, LIST returns a list of newsgroups, one newsgroup name on a line in this form:
group last first p


rfc: "where <group> is the name of the newsgroup, <last> is the
number of the last known article currently in that newsgroup,
<first> is the number of the first article currently in the
newsgroup, and <p> is either 'y' or 'n' indicating whether posting
to this newsgroup is allowed ('y') or prohibited ('n')."


The list is probably terminated by a line with a single dot (.)
So just read the whole thing into a buffer, well sort of let it 'flow' through a buffer, as soon as you got a full line, parse it, process it and remove it. Continue this until you've reached the terminating line.


appear to be gettting a socket error. my messagebox appears.


Are you using blocking or non-blocking sockets? If non-blocking, the error is probably WSAEWOULDBLOCK which indicates there's no data available yet. Don't forget you have to check everything (how much data is actually sent, how much you received etc) when using non-blocking sockets.


another question i have is whether or not im required to send a name and password. ive established a connection with a news server so in this situation i dont think ill need to is this correct or do i need to send a generic name and password still?


I don't know this for sure but I can reach the server without any authentication. So I guess it's not required..

Thomas
Posted on 2002-01-07 14:43:18 by Thomas