Re: Eu socket issues (was problems with webutils)
- Posted by gertie at ad-tek.net Aug 03, 2001
- 434 views
On 3 Aug 2001, at 9:11, Ted Fines wrote: > > Hi all, > > OK, so now I'm trying sockets stuff using eutcp4u. Kat sent me this > function: > > global function ReadServer(object sock) > sequence recievedline,sock_receive > recievedline = "" > while tcp4u_is_data_avail(sock[2]) do > sock_receive = tcp4u_receive(sock[2],1,1) > > if sock_connect[1] != TCP4U_SUCCESS then > printf(1, "tcp4u_connect error '%s'\n", > {tcp4u_error_string(sock_connect[tcp4u_ret])} ) > exit > end if > if equal(sock_receive[2],{10}) then > sock_receive[2] = "" > end if > if equal(sock_receive[2],{13}) > then > return recievedline > else > recievedline &= sock_receive[2] > end if > end while -- tcp4u_is_data_avail(sock[2]) do > return"" > end function -- checkserver > > So here's a little test code I wrote, to connect to the server. > -- open socket and connect > asock_conn=tcp4u_connect("141.140.1.2",NULL,143) > if asock_conn[1] != TCP4U_SUCCESS then > printf(1, "tcp4u_connect error '%s'\n", > {tcp4u_error_string(asock_conn[tcp4u_ret])} ) > abort(1) > end if > -- process login message data. if I don't have it sleep > -- here, sometimes 'result' comes back blank. Eu too fast > -- for its own good? > sleep(1) > result=ReadServer(asock_conn) > puts(1,result & "\n") > -- send login credentials > ret = tcp4u_send_sequence(asock_conn[2],"A LOGIN " & name & " " & > password & "\n") > if ret != TCP4U_SUCCESS then > printf(1, "tcp4u_send error '%s'\n", tcp4u_error_string(ret)) > end if > -- see if we logged in OK > sleep(1) > result=ReadServer(asock_conn[2]) ^ There is the problem, just by glancing at the code. global function ReadServer(object sock) expects the nested sequence, not the [2] part. But i am surprised there is no error msg. > puts(1,result & "\n") > > But here's the problem: result, after "see if we logged in OK" is ALWAYS > empty. Nothing comes back. Why not? I am sure the login request is > getting sent correctly, or ret would come back with an error response. > I've tried sending the login command a second and a third time, and looking > for a result. Nothing ever comes back. I have ended my A LOGIN command > above with "\r\n" and "\n" with the same result. > > So it seems I have a connection, and I seem to be sending data OK, yet > nothing comes back??? Should i post the entire email checker? I didn't get to retrieving the email yet, just getting a header list. I haven't had time to do *any* coding lately. Kat