flat assembler
Message board for the users of flat assembler.

Index > Windows > connect & recv

Author
Thread Post new topic Reply to topic
dacid



Joined: 31 Aug 2008
Posts: 57
dacid
i connect to a port using "connect" and then i try to receive the data with "recv" but it fails. I suspect that first i must "send" something after "recv"... is this correct?
Post 03 Dec 2008, 23:31
View user's profile Send private message Reply with quote
MoXter



Joined: 29 Apr 2006
Posts: 3
MoXter
If no error occurs, recv returns the number of bytes received. If the connection has been gracefully closed, the return value is zero. Otherwise, a value of SOCKET_ERROR is returned, and a specific error code can be retrieved by calling WSAGetLastError. As you didnt send any data,function return error.
Post 04 Dec 2008, 00:28
View user's profile Send private message Reply with quote
dacid



Joined: 31 Aug 2008
Posts: 57
dacid
buy when you connect to a port that "returns" something it is neccessary to send something before recv?
Post 04 Dec 2008, 09:20
View user's profile Send private message Reply with quote
asmcoder



Joined: 02 Jun 2008
Posts: 784
asmcoder
[content deleted]


Last edited by asmcoder on 14 Aug 2009, 14:54; edited 1 time in total
Post 04 Dec 2008, 10:59
View user's profile Send private message Reply with quote
dacid



Joined: 31 Aug 2008
Posts: 57
dacid
It is a console application:

Code:

LOCAL   recvbuf[4096]:BYTE

invoke  connect,hSocket,ADDR sockinfo,size sockaddr

...

invoke  select,hSocket,0,ADDR readfds,0,ADDR timeout

invoke  recv,hSocket,ADDR recvbuf,4096,NULL

    


GetLastError returns 10035 & 10057
Post 04 Dec 2008, 14:31
View user's profile Send private message Reply with quote
asmcoder



Joined: 02 Jun 2008
Posts: 784
asmcoder
[content deleted]


Last edited by asmcoder on 14 Aug 2009, 14:54; edited 1 time in total
Post 04 Dec 2008, 14:46
View user's profile Send private message Reply with quote
dacid



Joined: 31 Aug 2008
Posts: 57
dacid
you can change invoke to call and its the same in this particular case... the connect function and select works ok... plz dont tell me in what language should i code Smile
Post 04 Dec 2008, 19:11
View user's profile Send private message Reply with quote
asmcoder



Joined: 02 Jun 2008
Posts: 784
asmcoder
[content deleted]


Last edited by asmcoder on 14 Aug 2009, 14:54; edited 1 time in total
Post 04 Dec 2008, 20:39
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4633
Location: Argentina
LocoDelAssembly
dacid, save some time by searching the forum for already working examples and/or links instead.
Post 04 Dec 2008, 21:07
View user's profile Send private message Reply with quote
dacid



Joined: 31 Aug 2008
Posts: 57
dacid
I cant post all source because it is code for my job Sad i will keep on trying Smile

LOCAL defines a LOCAL variable or buffer, in this case it is a BUFFER of 4096 bytes where the data "recv" will be stored.

ADDR its offset.

Thx you anyway!
Post 06 Dec 2008, 23:05
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.