Skip to content

send udp packet and receive in host, for dev. other project, utility

Notifications You must be signed in to change notification settings

ghmoon90/pyUDPtool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

pyUDPtool

send udp packet and receive in host, for dev. other project, utility It consists of two project,

  1. pyUDPhost : host a udp server and listen to a designated port
  2. pyUDPsend : send a stream from csv file row by row, according to designated castType for each colum.

pyUDPhost

open a server listening UDP socket
usage :

python pyUDPhost.py --ip 127.0.0.1 --port 5500

pyUDPsend

pyUDPSend

It sends arbirary data stream (csv form) according to designated cast type for each column.
To send a data stream, you need a csvfile formated data table

34.7915,128.6954,62.44,63.28,60.5,225,160,61
34.7328,128.63,69.41,61.54,65.63,233,209,151
34.9676,128.3873,64.54,65.12,68.69,4,177,221
34.1309,128.1063,62.14,65.54,61.33,172,67,236

each column will be packed according to cast type in castType.json

{
    "column1": "double",
    "column2": "double",
    "column3": "float",
    "column4": "float",
    "column5": "float",
    "column7": "byte",
    "column8": "byte",
    "column9": "byte"
}

To run this code, process next line in terminal

python pyUDPSend.py castType.json test.csv 127.0.0.1 5500 

pyUDPm2

It sends arbirary data stream (csv form) according to designated cast type for each column.
in mode2, it can have predefined header bytes in front and checksum byte in tail.
for the setting, you need to edit a settings.json file. see ex_setting.json

syntax : follow json format
component : castType, csv_file, ip, port, header, checksumFlag
ex <ex_setting.json>

{
    "castType": "castType.json",
    "csv_file": "csv_file.csv",
    "ip": "192.168.0.1",
    "port": 5500,
    "header" : "0x000003F264"
    "checksumNote" : 1 #or 0 
}

how to run the code, use following syntax

python pyUDPm2.py ex_setting.json 

note !
header should be described in hex value. and fill zeros for digits preserves

Any support is welcome

1.buy me a coffe
2.Kaspa coin wallet
(Don't send other currency to this, it will make unintentional loss)

kaspa:qqtjrkyrten8uzvf9ffrn68nj3jw83q8yaaxdcl695nctr803mf9z9r8v0k7x

3. bitcoin wallet

bc1q0rxl49ygktx0n66umevy6vzqk02eshyxq5ppzc

About

send udp packet and receive in host, for dev. other project, utility

Resources

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

No packages published