Network Component  
MDK Middleware for IPv4 and IPv6 Networking
 
Loading...
Searching...
No Matches

Functions of the SLIP interface. More...

Functions

netStatus netSLIP_Listen (void)
 Start SLIP interface to accept incoming SLIP connections. [thread-safe].
 
netStatus netSLIP_Connect (const char *dial_num)
 Start a dial-up connection to remote SLIP server. [thread-safe].
 
netStatus netSLIP_Close (void)
 Disconnect SLIP link between two modems. [thread-safe].
 
bool netSLIP_LinkUp (void)
 Determine the state of SLIP link. [thread-safe].
 

Description

Functions of the SLIP interface.

To start a dial-up connection to a remote SLIP server, use netSLIP_Connect (client mode). If you want to wait for an incoming connection, use netSLIP_Listen instead (server mode). To check the link status, use netSLIP_LinkUp. This can be done in client and server mode and can be used to continuously monitor the SLIP link. To disconnect the SLIP link, use netSLIP_Close (for client and server mode). Usually, this is done by the client. Note that the netSLIP_Close function does not change the running mode of the SLIP daemon. If the SLIP daemon was in server mode, SLIP daemon re-initializes the modem driver to accept further incoming calls.

Function Documentation

◆ netSLIP_Close()

netStatus netSLIP_Close ( void  )

Disconnect SLIP link between two modems. [thread-safe].

Returns
status code that indicates the execution status of the function.

The function netSLIP_Close disconnects the SLIP link between the two modems.

Possible netStatus return values:

  • netOK: Disconnection started.
Note
  • You can call the netSLIP_Close function when the SLIP network daemon is either in client mode or in server mode.
  • Since the SLIP client starts a dial-up connection, it is also the SLIP client that usually disconnects the SLIP link.
  • The netSLIP_Close function does not change the running mode of the SLIP daemon. If the SLIP daemon was in server mode, SLIP daemon re-initializes the modem driver to accept further incoming calls.

Code Example

void disconnect_link (void) {
// Disconnect a dial-up link.
}

◆ netSLIP_Connect()

netStatus netSLIP_Connect ( const char *  dial_num)

Start a dial-up connection to remote SLIP server. [thread-safe].

Parameters
[in]dial_numphone number of remote SLIP server.
Returns
status code that indicates the execution status of the function.

The function netSLIP_Connect starts a dial-up connection to the remote SLIP server by starting the SLIP daemon in client mode.

The argument dial_num points to a null-terminated string containing the phone number of the remote SLIP server.

Possible netStatus return values:

  • netOK: Dial-up connection started.
  • netInvalidParameter: Invalid dial_num parameter provided.
  • netWrongState: Dial-up connection already established.
Note
  • You must call the netSLIP_Connect function when you want to establish a dial-up connection using SLIP.
  • When using a direct cable connection, you can set dial_num to NULL because the Null_Modem device driver ignores dial_num.

Code Example

void dial_remote (void) {
// Dial remote SLIP Server.
netSLIP_Connect ("04213372");
}

◆ netSLIP_LinkUp()

bool netSLIP_LinkUp ( void  )

Determine the state of SLIP link. [thread-safe].

Returns
link state:
  • true = Link is up, IP frames can be exchanged.
  • false = Link is down.

The function netSLIP_LinkUp determines the state of SLIP link between the two modems. It returns true if IP frames can be exchanged over the SLIP link.

Note
  • You can call the netSLIP_LinkUp function when the SLIP network daemon is either in client mode or in server mode.
  • You can also use the netSLIP_LinkUp function to continuously monitor the state of the SLIP link.

Code Example

void connect_soc (void) {
// Connect TCP socket when SLIP is up.
netTCP_Connect (socket_tcp, remip, 1000, 0);
}
}

◆ netSLIP_Listen()

netStatus netSLIP_Listen ( void  )

Start SLIP interface to accept incoming SLIP connections. [thread-safe].

Returns
status code that indicates the execution status of the function.

The function netSLIP_Listen configures the SLIP interface to accept incoming SLIP connections by starting the SLIP daemon in server mode.

Note
It is common to call netSLIP_Listen at system start-up.

Possible netStatus return values:

  • netOK: Listening to inbound dial-up connections started.
  • netWrongState: Dial-up connection already established.

Code Example

int main (void) {
// Activate the SLIP interface.
..
}