T
T
Type Programmer2019-09-15 18:42:21
assembler
Type Programmer, 2019-09-15 18:42:21

Assembler WinAPI sockets, Accept not waiting for connection?

What is wrong or where? .. Accept seems to be not being executed) I tried to find what and where is wrong, not a single function seems to return errors, I seem to do everything the same as in the book, well, there is a different compiler, so I write in my own way, and the win32ax library instead of including user32.lib, kernel32.lib, ws2_32.lib

Format PE GUI 4.0
include "win32ax.inc"

start:
invoke AllocConsole
invoke GetStdHandle,STD_OUTPUT_HANDLE
mov [STDO],eax
invoke WriteConsole,eax,mes1,19,0,0
invoke WSAStartup,0202h,WSA
invoke socket,2,1,0
mov [socket_server],eax
invoke bind,[socket_server],addr,sizeof.sockaddr_in
invoke listen,[socket_server],5
invoke accept,[socket_server],addr_client,sizeof.sockaddr_in
invoke WriteConsole,[STDO],mes2,29,0,0
jmp $
.end start

error:
invoke MessageBox,0,'Eror','LOL',0
jmp $

mes1 db 'Server starting..',10,13
mes2 db 'New user connected, receiv:',10,13
buff db 255 dup (?)

struc WSAdata
{
.wVersion       dw ?
.wHighVersion   dw ?
.szDescriotion  db 257 dup (?)
.szSystemStatus db 129 dup (?)
.iMaxSockets    dw ?
.iMaxUdpDg      dw ?
.lpVendorInfo   dd ?
}

struc sockaddr_in
{
.sin_family dw 2
.sin_port   dw 1333
.sin_addr   IP
.sin_zero   db 8 dup (?)
}

struc IP
{
.a_b1 db 0
.a_b2 db 0
.a_b3 db 0
.a_b4 db 0
}

socket_server dd 0
STDO  dd 0
addr  sockaddr_in
WSA   WSAdata
addr_client sockaddr_in

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
jcmvbkbc, 2019-09-16
@MegaCraZy6

invoke accept,[socket_server],addr_client,sizeof.sockaddr_in

accept expects a pointer to the size as the last parameter, not the size itself.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question