News:

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

(RESOLVED thanks tedd)Winsock Error Code: 10038

Started by blackwc, May 06, 2007, 05:28:56 AM

Previous topic - Next topic

blackwc

sorry for the three post...

But if anyone is interested... STILL the same old error...

scan proc uses edi
invoke socket,AF_INET,SOCK_STREAM,0
.if eax != INVALID_SOCKET
mov sock,eax
.else
invoke MessageBox,hwnd,eax,addr error,MB_ICONERROR
.endif

invoke WSAAsyncSelect,sock,hwnd,WM_SOCKET,FD_CONNECT
.if eax==SOCKET_ERROR
invoke MessageBox,hwnd,eax,addr error,MB_ICONERROR
.endif

;------------------------------------
invoke GetWindowTextLength,hbox1
inc eax
invoke GetWindowText,hbox1,addr target,eax
;------------------------------------

assume edi:ptr sockaddr_in
mov [edi].sin_family, AF_INET
invoke inet_addr,addr target
invoke htons,80
mov [edi].sin_port,ax

invoke inet_addr,addr target
.if eax==INADDR_NONE
invoke gethostbyname,addr target
.if eax != NULL
mov eax, (hostent ptr [eax]).h_list
mov eax, [eax]
mov eax, [eax]
.endif
.endif

mov [edi].sin_addr,eax

invoke connect,sock,edi,sizeof sockaddr_in
.if eax==SOCKET_ERROR
invoke WSAGetLastError
.if eax != WSAEWOULDBLOCK
invoke geterror
jmp @F
.endif
.else
invoke closesocket,sock
.if eax==SOCKET_ERROR
invoke geterror
jmp @F
.endif
.endif
@@:
assume edi:nothing
ret
scan endp

Tedd

I made a little program - adding the necessary bits to make it work - inserted your 'scan' and 'geterror' functions.. and it worked. Connection successful.
The only modifcation I did make was with "invoke MessageBox,hwnd,eax,addr error,MB_ICONERROR" where 'eax' would cause an access violation (just changed to "addr error")

So, for the THIRD TIME: the error lies somewhere else in your code. (It may not surface until connection, but that doesn't mean connection is causing the error.)


[attachment deleted by admin]
No snowflake in an avalanche feels responsible.

blackwc

Quote from: Tedd on May 10, 2007, 11:58:21 AM
I made a little program - adding the necessary bits to make it work - inserted your 'scan' and 'geterror' functions.. and it worked. Connection successful.
The only modifcation I did make was with "invoke MessageBox,hwnd,eax,addr error,MB_ICONERROR" where 'eax' would cause an access violation (just changed to "addr error")

So, for the THIRD TIME: the error lies somewhere else in your code. (It may not surface until connection, but that doesn't mean connection is causing the error.)


That example helped me a lot... I located the error, the target wasn't loading the IP and all that junk... It was still in the proc function, it just didn't have anything to do with the winsock  code. Thanks anyways... I appreciate your patience and your example.