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

NET SendVar

From FenixWiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 19:49, 12 September 2007 (edit)
Sandman (Talk | contribs)
(New page: Category:functions Category:networkdll Category:dll '''Up to Network.DLL Functions''' ---- ==Definition== '''INT''' NET_SendVar ( <'''WORD'''...)
← Previous diff
Current revision (11:59, 2 October 2007) (edit) (undo)
Sandman (Talk | contribs)
m (Returns)
 
(3 intermediate revisions not shown.)
Line 8: Line 8:
==Definition== ==Definition==
-'''INT''' NET_SendVar ( <'''WORD''' connection> , <'''BYTE POINTER''' message> , <'''INT''' length> , [<'''BYTE''' includeseparator>] )+'''INT''' NET_SendVar ( <'''WORD''' connection> , <'''BYTE POINTER''' data> , <'''INT''' length> , [<'''BYTE''' includeseparator>] )
-Sends a message in array form or send a byte, word or int.+Sends data in array form or a byte, word or int or whatever other variable.
A null character on the end is not needed: A null character on the end is not needed:
- NET_SendVar( netid , &msg , sizeof(msg) );+ NET_SendVar( netid , &data , sizeof(data_element)*elements );
 +Or send an integer:
 + NET_SendVar( netid , &my_int , sizeof(int) );
Or send a struct: Or send a struct:
NET_SendVar( netid , mystruct , sizeof(mystruct) ); NET_SendVar( netid , mystruct , sizeof(mystruct) );
Line 21: Line 23:
| '''WORD''' connection || - The connection identifier. | '''WORD''' connection || - The connection identifier.
|- |-
-| '''BYTE''' pointer message || - The pointer to the message/variable.+| '''BYTE POINTER''' data || - The pointer to the data/variable.
|- |-
-| '''INT''' length || - The length/size of the message/variable.+| '''INT''' length || - The length/size of the data/variable.
|- |-
-| ['''BYTE''' includeseparator] || - [[true]]/[[false]]: whether the connection's separator will be added to the message at the end. Default is true.+| ['''BYTE''' includeseparator] || - [[true]]/[[false]]: whether the connection's separator will be added to the data at the end. Default is true.
|} |}
Line 35: Line 37:
| NET_ERROR_CONNINACTIVE || - The connection is inactive. | NET_ERROR_CONNINACTIVE || - The connection is inactive.
|- |-
-| NET_ERROR_MESSAGETOOLONG || - The message is too long.+| NET_ERROR_MESSAGETOOLONG || - The data is too big.
|- |-
| NET_ERROR_SENDING || - Could not send. | NET_ERROR_SENDING || - Could not send.
Line 44: Line 46:
== Notes == == Notes ==
Make sure the data is received properly. If you send a struct, be sure the receiver knows he should be receiving a struct and then receive the struct like it should. [[NET_RecvVar]]() is helpful for this. Make sure the data is received properly. If you send a struct, be sure the receiver knows he should be receiving a struct and then receive the struct like it should. [[NET_RecvVar]]() is helpful for this.
 +
 +{{Netfuncbox}}

Current revision

Up to Network.DLL Functions



Contents

[edit] Definition

INT NET_SendVar ( <WORD connection> , <BYTE POINTER data> , <INT length> , [<BYTE includeseparator>] )

Sends data in array form or a byte, word or int or whatever other variable.

A null character on the end is not needed:

NET_SendVar( netid , &data , sizeof(data_element)*elements );

Or send an integer:

NET_SendVar( netid , &my_int , sizeof(int) );

Or send a struct:

NET_SendVar( netid , mystruct , sizeof(mystruct) );

[edit] Parameters

WORD connection - The connection identifier.
BYTE POINTER data - The pointer to the data/variable.
INT length - The length/size of the data/variable.
[BYTE includeseparator] - true/false: whether the connection's separator will be added to the data at the end. Default is true.

[edit] Returns

INT : The size of the succesfully sent data. 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 data is too big.
NET_ERROR_SENDING - Could not send.
>=0 - The size of the succesfully sent data. With the separatorlength, if the separator was added.

[edit] Notes

Make sure the data is received properly. If you send a struct, be sure the receiver knows he should be receiving a struct and then receive the struct like it should. NET_RecvVar() is helpful for this.


Network.DLL Functions
Global NET_Init() • NET_Quit() • NET_Version() • NET_IntVersion() • NET_About() • NET_GetError() • NET_Stat_Buffer() • NET_IntToIP() • NET_IPToInt()
Connections NET_Connect() • NET_Listen() • NET_Disconnect() • NET_DisconnectAll()
Connection NET_Resolve() • NET_Hostname() • NET_IPAddress() • NET_Port() • NET_Separator() • NET_GetSeparator() • NET_GetSeparatorLength()
Transfer NET_Recv() • NET_RecvFile() • NET_RecvGraph() • NET_RecvVar() • NET_Send() • NET_SendFile() • NET_SendGraph() • NET_SendRN() • NET_SendVar()
Personal tools