News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Winsock

Started by GuyL, March 30, 2008, 07:06:59 PM

Previous topic - Next topic

GuyL

I got my own e-mail program,which began with a port 110, work just fine. I got a new e-mail which began with a port 995 but it doesn't work.
It's a SOCKER ERROR.

Is Winsock doesn't work port 995?


Guy

Ossa

WinSock works with all ports. Could you be a little more specific in stating what the problem is, please?
Website (very old): ossa.the-wot.co.uk

Tedd

The whole purpose of connecting to ports is that it identifies the specific service you require. Port 110 is for the POP3 service - so when you connect to the server on port 110, the server expects you to be following that protocol. You can't just decide to connect on any other port and expect it to know what you want. The email service (pop) will only work on port 110 (or 143 if you use IMAP instead.)
No snowflake in an avalanche feels responsible.

GuyL

The ConnectSocket show an error. See below

ConnectSocket proc

      invoke socket, PF_INET, SOCK_STREAM,0

     .IF eax!=INVALID_SOCKET
          mov sock,eax
          ;Fill our SocketAdress Structure with data
          mov SocketAdress.sin_family, PF_INET                   ;there is only one PF_INET
          invoke htons,HTTPPort                                        ;convert port into network byte order
          mov SocketAdress.sin_port, ax                              ;note this is a 16bit word size param
          invoke inet_addr, ADDR szHostName                      ;let's assume the user typed "214.121.55.214" as Host

     .IF eax==INADDR_NONE                                           ;If INADDR_NONE occurs it is a "www.it.fr" sort of adress
          invoke gethostbyname,ADDR szHostName

        .IF eax==NULL
         invoke ShowErrorAndClose                                     ; no host? why did we fail? anyway... show & close
         ret
        .ENDIF

               mov eax,[eax+ 12]                                           ; move the value of h_list member into eax
               mov eax,[eax]                                                  ; copy the pointer to the actual IP address into eax
               mov eax,[eax]                                                  ; copy IP address into eax
    .ENDIF

       mov SocketAdress.sin_addr, eax
         
       invoke WSAAsyncSelect,sock,hWnd,WM_SOCKET,\        ;Setting up what messages we're interested in
                    FD_CONNECT or FD_READ or FD_CLOSE

          .IF eax==NULL  ;successfull
               invoke connect, sock, ADDR SocketAdress, SIZEOF SocketAdress


; port 995 show an error

               .IF eax==SOCKET_ERROR            ; port 995 show an error here
                                                               ;
                invoke WSAGetLastError              ; undefined error
     
               .IF eax!=WSAEWOULDBLOCK
                invoke ShowErrorAndClose

     .ENDIF
               .ENDIF
          .ELSE
               invoke ShowErrorAndClose         
          .ENDIF
         
     .ELSE


          invoke ShowError                             
          ret
     .ENDIF
     ret
ConnectSocket end



Guy

Ossa

Port 995 POP3 operates over SSL. This, I assume, is the cause of your problem. I am unfamiliar with SSL sockets and how they differ from normal sockets. I will have a little look at it tomorrow if someone else hasn't helped you out already.

Ossa
Website (very old): ossa.the-wot.co.uk

Ossa

OK, was just about to hit the sack, but I suddenly thought of this:

In the Platform SDK, go to:

YourPlatformSDKFolder\Samples\Security\SSPI\SSL\WebClient

and there is a C example... in the readme:

QuoteThis sample is intended as a demonstration of the SSPI interface to the SSL/PCT
protocols for secure, authenticated communication provided by secur32.dll and
schannel.dll on Microsoft Windows NT 4.0 w/SP4, Microsoft Windows 2000,
Microsoft Windows Millennium, and Windows 9x.

Which might help you on your way.

Ossa
Website (very old): ossa.the-wot.co.uk

Tedd

Are you sure the server you're connecting to is actually providing the SPOP service? (Just because it offers plain POP, doesn't mean it will support any other type.)
No snowflake in an avalanche feels responsible.