flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
gumletis 21 Feb 2005, 19:34
anybody?
|
|||
![]() |
|
JohnFound 21 Feb 2005, 20:44
Code: include '%fasminc%\win32ax.inc' .data wsaData WSADATA sock dd 0 sin sockaddr_in web db '127.0.0.1',0 hello db 'hello world',0 .code start: invoke WSAStartup,0101h,wsaData invoke socket,AF_INET,SOCK_STREAM,0 mov dword[sock],eax invoke htons,25 mov word[sin.sin_port],ax mov word[sin.sin_family],AF_INET invoke gethostbyname,web cmp eax,0 je notexist mov eax,[eax+12] mov eax,[eax] mov eax,[eax] mov dword[sin.sin_addr],eax invoke lstrlen,sin invoke connect, sock,sin,eax ; sockaddr_in is not a string!!! use sizeof.sockaddr_in instead. invoke lstrlen,hello invoke send, sock, hello,eax,0 invoke ExitProcess,0 notexist: invoke MessageBox,0,'That Host Not Exist','404 Error',0 RET .end start Also, check whether you want to use "sock" (address of the variable "sock") or "[sock]" - content of this variable, that is socket handle. Also in most places you simply don't need "dword" prefix before the variables (like in "mov dword [sock], eax") - FASM can determine the size of the variables. Also, please, format your source more carefully. How you expect help, if the reader can't read the source? Regards |
|||
![]() |
|
gumletis 22 Feb 2005, 18:59
Thanks, it worked! nice my first winsock app, its just lol, need to know something about server now....
![]() _________________ LOOOL |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.