Applicable Versions
NetSim Standard

NetSim Pro


Applicable Releasesv12.2v13.0


For applications such as the Database, FTP, Custom, CBR, and Sensing, the function fn_NetSim_Application_StartDataAPP() defined in the Database_FTP_Custom.c file of the Application source code project is used to start the traffic generation.

Here the call to function fnCreatePort(appInfo); sets the transport-layer source and destination port numbers for the application.

You can either comment the call to this function and directly assign values for the following variables or add a condition after the call and modify the following variables for specific applications:
appInfo->sourcePort
appInfo->destPort
 


The source port and destination port variables are nSourcePort and nDestinaionPort declared as part of the structure struct stru_NetSim_Packet_TransportLayer, in the Packet.h file.

The UDP port numbers can be added to the trace file using the functions:
fn_NetSim_UDP_ConfigPacketTrace()
fn_NetSim_UDP_WritePacketTrace()
which are part of the UDP.c file.

The source and destination port variables can be accessed from the packet directly. The variables can be accessed in the following way:
pstruPacket->pstruTransportData->nSourcePort
pstruPacket->pstruTransportData->nDestinaionPort 

You can refer to the following article to get additional columns in the trace file: how-to-add-an-extra-custom-column-in-netsim-packet-trace-