ping

Test communication between development and target computers

Description

example

link_status = ping(target_object) tests at a low level whether the development computer and the target computer represented by target_object can communicate using the settings stored in target_object. If a data channel is open between the development and target computers, the function leaves it open.

link_status = ping(target_object, 'default') and [link_status connection_info] = ping(target_object) have the same behavior as ping(target_object).

example

[link_status connection_info] = ping(target_object, 'info') uses the information/control channel to return information about the Simulink® Real-Time™ connection between the development and target computers. If a data channel is open between the development and target computers, the function leaves it open.

example

[link_status connection_info] = ping(target_object, 'reset') uses the information/control channel to close an open data channel between the development and target computers and then returns link status and connection information.

Examples

collapse all

target_object = slrt;
link_status = ping(target_object)
link_status =

success
target_object = slrt('TargetPC1');
link_status = ping(target_object)
link_status =

failed
target_object = slrt;
[link_status connection_info] = ping(target_object, 'info')
link_status =

success

connection_info =

10.10.10.100
target_object = slrt('TargetPC1');
[link_status connection_info] = ping(target_object, 'info')
link_status =

success

connection_info =

Disconnected
target_object = slrt('TargetPC1');
[link_status connection_info] = ping(target_object, 'info')
link_status =

failed

connection_info =

'fail: Target machine did not respond.'
target_object = slrt;
[link_status connection_info] = ping(target_object, 'reset')
link_status =

success

connection_info =

Disconnected

Input Arguments

collapse all

Object that represents the target computer. Before calling this function, make sure that you start the target computer with the Simulink Real-Time kernel and apply the required Ethernet link settings.

Example: tg

Output Arguments

collapse all

If you call ping without a second argument:

  • If communication is possible, connection_info is empty.

  • If communication is not possible, connection_info contains an error message.

If you call ping with a second argument of 'info':

  • If the connection is active, connection_info reports the development computer network address to which the target computer is connected.

  • If the connection is not active, connection_info contains 'Disconnected'.

  • If communication is not possible, connection_info contains an error message.

If you call ping with a second argument of 'reset':

  • If communication is possible, connection_info contains 'Disconnected'.

  • If communication is not possible, connection_info contains an error message.

Introduced in R2014a