After reading Iczelion's tute on Winsock, i tried to write my own. But i couldn't get this code to work if my life depended on it. Ic if you read this, you'd probably be the best to answer this, because it is straight out of your tutorial. The theory on this source is just to open a socket and send an address on port 80... .386 .model flat, stdcall include \masm32\include\ include \masm32\include\ include \masm32\include\ include \masm32\include\ includelib \masm32\lib\kernel32.lib includelib \masm32\lib\user32.lib includelib \masm32\lib\wsock32.lib WndProc PROTO .data MsgCap db "Error!",0 Msg db "Error(s) Occoured",0 Url db "",0 ;just an example addy Port dd 80 .data? wsadata WSADATA<> sin sockaddr_in<> hInstance dd ? sock dd ? buffer db 100 dup(?) .code start: invoke GetModuleHandle, NULL mov hInstance, eax invoke WndProc invoke ExitProcess,NULL WndProc PROC Main_Proc: invoke WSAStartup, 101h, offset wsadata cmp eax, 0 jne Main_Proc invoke socket, AF_INET, SOCK_STREAM, 0 cmp eax, INVALID_SOCKET je Main_Proc mov sock, eax mov sin.sin_family, AF_INET invoke htons, Port mov sin.sin_port,ax invoke gethostbyname, addr Url mov eax, mov eax, mov eax, mov sin.sin_addr,eax invoke connect,socket,addr sin,sizeof sin .if eax==SOCKET_ERROR invoke WSAGetLastError .if eax!=WSAEWOULDBLOCK invoke MessageBox, NULL, addr Msg, addr MsgCap, NULL .endif .endif invoke wsprintf, addr buffer, offset Url invoke send, sock, addr buffer, 100, 0 .if eax==SOCKET_ERROR invoke MessageBox, NULL, addr Msg, addr MsgCap, NULL .endif invoke closesocket, sock invoke WSACleanup ret WndProc ENDP end start Thanks for any help i can get. Nokturnal
Posted on 2001-01-29 15:01:00 by Nokturnal
The first thing I found is that you have to put this line in the begin of your code, or it will not compile: option casemap :none ; case sensitive it will be placed just after : .386 .model flat, stdcall After that, I could compile your code, but it gives me a gpf when I tryed to run it. I am trying to found why. regards : ssaguiar
Posted on 2001-01-29 21:20:00 by ssaguiar
Another thing : you must change line : Url db "",0 ;just an example addy to : Url db "",0 ;just an example addy or you'll get the GPF I told you ssaguiar
Posted on 2001-01-29 21:24:00 by ssaguiar