NET Connect

From Bennu Wiki
Jump to navigation Jump to search


Up to Network.DLL Functions



Definition

INT NET_Connect ( <STRING address> , <WORD port> , [<BYTE consolereports>] )

Opens a connection to the specified address on the specified port. The opened connection can be disconnected with NET_Disconnect().

Also called NET_Open().

Parameters

STRING address - The address to which will be connected.
WORD port - The port on which will be connected.
[BYTE consolereports] - true/false: specifies whether there will be console reports for this connection (like messages).

Returns

INT : Connection identifier.

NET_ERROR_INVALIDSOCKETSET - The socketset is invalid.
NET_ERROR_SOCKETSETINACTIVE - The socketset is inactive.
NET_ERROR_INVALIDPORTNUMBER - The portnumber is invalid (<0 or >65535).
NET_ERROR_INVALIDTYPE - The type specified is invalid.
NET_ERROR_TOOMANYCONNS - There are too many connections
NET_ERROR_RESOLVINGHOST - Could not resolve host.
NET_ERROR_CONNECTING - Could not connect.
NET_ERROR_ADDINGSOCKET - Could not add socket to socketset.
0 - n - Connection identifier. (Where n is the number of maximum allowed connections)

Example

Program example;
    include "Network.fh";
Begin

    NET_Init(0,10,1);
    NET_Connect("www.google.com",80,true);
   
    Loop
        frame;
    End

End


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() • NET_Accept() • NET_Incoming_Accept()
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()