This wiki is out of date, use the continuation of this wiki instead

NET Send

From FenixWiki

Revision as of 01:36, 1 September 2007 by Sandman (Talk | contribs)
Jump to: navigation, search

Up to Network.DLL Functions



Contents

Definition

INT NET_Send ( <WORD connection> , <STRING message> , [<BYTE includeseparator>] )

Sends a certain message to the other peer on a certain connection.

It appears the message can also be a byte, word or integer. Just make sure the other peer receives it like it was sent. For those variables NET_SendVar() is recommended though.

Also called NET_Message().

Parameters

WORD connection - The connection identifier of the connection on which the other peer is to receive the message.
STRING message - The message.
[BYTE includeseparator] - true/false: whether the connection's separator will be added to the message at the end. Default is true.

Returns

INT : The size of the successfully sent message. With the separatorlength, if the separator was added.

NET_ERROR_INVALIDCONN - The connection is invalid.
NET_ERROR_CONNINACTIVE - The connection is inactive.
NET_ERROR_MESSAGETOOLONG - The message is too long.
NET_ERROR_MESSAGETOOSHORT - The message is too short.
NET_ERROR_SENDING - Could not send.
>=0 - The size of the successfully sent message. With the separatorlength, if the separator was added.

Example

Program example;
    include "Network.fh";
Private
    int netid;
Begin

    NET_Init(0,10,1);
    netid = NET_Connect("www.google.com",80,true);
    NET_Send(netid,"HELLO!"+chr(13)+chr(10)); // This is not a valid HTTP protocol message
   
    Loop
        frame;
    End

End
Personal tools