invoke accept,hSocket,ADDR ClientAddress,ADDR ClientLen

invoke inet_ntoa, ADDR ClientAddress.sin_addr <- dont work
invoke inet_ntoa, ADDR ClientAddress.sin_addr.S_un.S_addr <- same :(


Ideas?
Posted on 2002-01-25 06:22:44 by Elmenda
All network related posts should be posted in the networking section..

but anyways, i guess you are using accept on the FD_READ message.

try:
invoke accept,[b]wParam[/b],addr ClientAddress,addr ClientLen

invoke inet_ntoa, ClientAddress.sin_addr.S_un.S_addr
;eax is now a pointer to the ip string
;invoke MessageBox, hDlg, eax, 0, MB_OK


corrected the code, see Thomas' code below ;)
Posted on 2002-01-25 08:52:24 by savage
I moved thread.
Posted on 2002-01-25 09:28:25 by f0dder
I dont use a window or dialog ... nor FD_ACCEPT or FD_READ

SOCKET PASCAL FAR accept ( SOCKET s, struct sockaddr FAR * addr, int FAR * addrlen );

s A descriptor identifying a socket which is listening for
connections after a listen().

.....

The argument addr is a result parameter that is filled in with the address of the connecting entity, as known to the communications layer.

:?
Posted on 2002-01-25 09:30:50 by elmenda
Remove 'ADDR' in the inet_ntoa calls.

Thomas
Posted on 2002-01-25 11:25:00 by Thomas
invoke inet_ntoa, ClientAddress.sin_addr

error A2114: INVOKE argument type mismatch : argument : 1

then

push ClientAddress.sin_addr
call inet_ntoa


IT WORKS!!

thx a lot :)
Posted on 2002-01-25 11:45:03 by elmenda
This should worl:


invoke inet_ntoa, ClientAddress.sin_addr.S_un.S_addr


The sin_addr member is a in_addr structure, and inet_ntoa wants a dword so you have to use the union inside to tell masm it's a dword.

Thomas
Posted on 2002-01-25 12:08:59 by Thomas