- This wiki is out of date, use the continuation of this wiki instead
NET Recv
From FenixWiki
(Difference between revisions)
Revision as of 15:10, 14 April 2007 (edit) Sandman (Talk | contribs) m (→Parameters) ← Previous diff |
Revision as of 15:15, 14 April 2007 (edit) (undo) Sandman (Talk | contribs) m Next diff → |
||
Line 25: | Line 25: | ||
| ['''BYTE''' includeseparator] || When true, the separator will be added to the message at the end. When false, it won't. Default is true. | | ['''BYTE''' includeseparator] || When true, the separator will be added to the message at the end. When false, it won't. Default is true. | ||
|} | |} | ||
+ | |||
== Returns == | == Returns == | ||
Line 34: | Line 35: | ||
| !"" || The message (string). It appears this can also be a byte, word or integer. Just make sure the other peer sent it like it was received. | | !"" || The message (string). It appears this can also be a byte, word or integer. Just make sure the other peer sent it like it was received. | ||
|} | |} | ||
+ | |||
== Example == | == Example == |
Revision as of 15:15, 14 April 2007
Contents |
Definition
INT NET_Recv ( WORD connection , [BYTE includeseperator] )
Gets the waiting message on a connection. The function will keep returning messages until it returns "", which indicates no more new messages. So it is best to put this function in a frameless loop, like so:
msg = NET_GetMessage(conn_c); Repeat say("Incoming(" + conn_c + "): " + msg); msg = NET_GetMessage(conn_c); Until(len(msg)<=0)
This way it will still return "" if "" was indeed sent. If you don't need this or you have some other reason, you can change the loop to suit your needs.
Also called NET_GetMessage().
Parameters
WORD connection | The connection identifier. |
[BYTE includeseparator] | When true, the separator will be added to the message at the end. When false, it won't. Default is true. |
Returns
INT : Network.DLL Errorcode
"" | There was an error or no message. |
!"" | The message (string). It appears this can also be a byte, word or integer. Just make sure the other peer sent it like it was received. |
Example
Program example; include "Network.fh"; Private int netid; string message; Begin NET_Init(0,10,1); netid = NET_Connect("www.google.com",80,true); Loop If(NET.Incoming[netid]) While( (message = NET_GetMessage(netid)) !="" ) say("Incoming(" + netid + "): " + message); End End frame; End End