About this program
PortDock UDP is a test tool that exchanges UDP datagrams with devices.
There is no connection: it receives on a port you choose and sends to a destination you choose (or to the last sender).
It supports broadcast, multicast, echo, checksums and file logging.
Getting started
- 1. Under «Local (this PC)», enter the «Bind address» (usually 0.0.0.0) and the «Listen port» the device sends to.
- 2. Under «Destination (default)», enter the device «Host» (IP) and «Port». Leave it empty if you only receive.
- 3. Press «Start». When the status shows «Listening», you are ready.
- 4. Type in the input and press «Send» (or Enter). Received data shows as RX ◀, sent data as TX ▶, with the peer address.
Layout
- Left: local and destination settings, the «Advanced connection» section (broadcast, multicast), «Start»/«Stop», status, «Senders», the «Receive settings» section (RX checksum check, echo), «Log to file».
- «Advanced connection» and «Receive settings» are collapsed with the current values next to the title («broadcast · 239.0.0.1», «No checksum check»). They start expanded when anything is set, and their open state is remembered.
- Toolbar: «View» (HEX, ASCII, «Both» — «Both» at first), «Auto-scroll», byte counters, «Save view», «Clear».
- Below the toolbar, the find/filter row: find box, ▲/▼, «Matches only», «FAIL only», direction (All/RX/TX/EV). See «Find and filter the log».
- Log: time, direction (RX ◀ / TX ▶ / EV), peer address, data. One datagram is one line (no framing needed).
- Bottom: send row (target, HEX/ASCII, input, checksum, line ending, «Send»), «Bytes to send», «Repeat (ms)», «+ Save to list».
- Right: «Commands», «Triggers» and «Detail» (click a log line to see peer, length, HEX, ASCII).
- In a narrow window (1180 px or less) the right pane hides; open it with «☰ Commands · Detail» (just «☰» at 1100 px or less). Clicking a log line opens it at «Detail».
- The repeat count shows on the second send row only while repeat is on or a count is set; otherwise set it under «⋯ More».
- 📌 in the header: always on top — keeps this window above others (same as «Always on top» in Settings).
- The window title shows the current state (e.g. «COM3 115200 8N1 · Connected ● REC — PortDock Serial»), so you can tell windows apart on the taskbar.
- At 900 px wide or less (e.g. half-screen snap) the left connection panel folds away and a summary line with «⚙ Connection» and the connect button appears. «⚙ Connection» opens the panel; ✕ or clicking outside closes it.
- The toolbar has «View options» (time gap column: none / gap from previous line / response time); the right side of the status line shows throughput (RX/TX B/s), frame counts and «last RX n s ago».
- Second send row: «Repeat (ms)», «times», «+ Save to list». ⚙ next to the checksum opens checksum options.
- «Triggers» sits below «Commands» in the right pane (click ▸ to expand).
Local and destination
- «Bind address (0.0.0.0 = all NICs)»: which network card receives. Enter this PC's IP of a specific card to limit it.
- «Listen port (0 = any)»: with 0 the OS picks a free port and the status line shows it.
- «Destination (default)»: used when the send target is «Destination». You can change it while running.
- A change made while running is applied shortly after you stop typing. If it fails (e.g. the host cannot be resolved), the fields turn red with a note that the previous address is still in use, and sending to «Destination (default)» is blocked until fixed, so nothing goes to the old address. «Default destination (…)» in the send row shows the address actually applied.
- Send targets: «Destination», «Last sender», or a specific address from «Senders».
- «Use as destination» next to a sender copies that address into the default destination.
- Up to 256 senders are remembered.
- Bind address/port, broadcast and multicast are locked (🔒) while running; stop to change them. Default destination, echo and the RX checksum check apply immediately.
Broadcast, multicast, echo
- «Allow broadcast»: required (before starting) to send to broadcast addresses such as 255.255.255.255 or 192.168.0.255. A warning shows if the destination is a broadcast address while it is off.
- «Multicast group»: an address in 224.0.0.0–239.255.255.255 is joined at start. Out-of-range addresses are rejected.
- «Multicast NIC»: IP of the card to join on. 0.0.0.0 uses the OS default.
- «Rejoin»: try it if multicast reception stops on Wi-Fi or after a network change.
- «Echo back to sender» (in «Receive settings»): returns each datagram to its sender. Can be toggled while running.
- Echo turns itself off above 200 per second (two echoing peers would loop forever); an «ECHO OFF …» line and an error appear. Your own looped-back broadcasts are not echoed.
Sending
Choose HEX or ASCII left of the input (ASCII at first). «Bytes to send» shows the exact bytes while you type, or why the input is invalid.
- If letters such as «hello» are typed in HEX mode, [Send as ASCII] appears next to the error. It switches to ASCII keeping the text and sends it right away ([Switch to ASCII] — switch only — before starting or without a destination).
- HEX: «01 03 0A», «01030A» and «0x01,0x03,0x0A» are the same 3 bytes. Use two digits per byte.
- ASCII: sent as typed. «\r» (CR), «\n» (LF), «\t», «\0», «\\» and «\xNN» are supported.
- «Checksum»: CRC16 Modbus, CRC16 CCITT, CRC16 XMODEM, CRC8, LRC, BCC (XOR), SUM8, SUM16, CRC-32 or CRC (custom). ⚙ next to it changes the range, position and byte order.
- «Line ending»: none, CR, LF or CR LF. The order is always «body + checksum + line ending».
- One send = one datagram. The OS refuses datagrams larger than about 64 KB.
- «Send» is disabled, with the reason shown, before starting or when the input is empty. With no destination (e.g. «Last sender» before anything arrived) an error message appears.
- Switching HEX↔ASCII converts the input to the same bytes in the new notation (e.g. «41 54 0D 0A» ↔ «AT» plus CR LF escapes). If the input cannot be read, the text is kept and a notice explains why.
- If a checksum is on when you switch, a notice (instead of a dialog) says so and offers «Turn checksum off».
Repeat and commands
- «Repeat (ms)»: sends the current input every interval (10 ms or more). It turns off when you stop.
- «+ Save to list» adds the current input (mode, checksum, line ending) to «Commands».
- Commands are kept after restarting.
- In the list, ▶ sends (Enter or double-click in the name too), ✎ is «Load into the input», ⧉ duplicates and ✕ deletes. A deleted command can be restored with «Undo» in the notice for 5 seconds (no confirmation dialog).
- Reorder with ↑/↓ left of the name, or Alt+↑/↓ in the name box.
- When the list is empty, «Add examples» puts in a few common example commands (names start with «e.g.»). Serial follows «Use»: AT, ATI, AT+GMR or Modbus FC03/FC04 reads; TCP adds *IDN? (SCPI), an HTTP request and a Modbus TCP read (two Modbus TCP reads when framing is Modbus TCP); UDP adds a text, *IDN? and a HEX example. No write commands are added.
- After «+ Add to list» the new command's name box is focused so you can rename it right away. «Add to commands» in a log line's right-click menu adds those exact bytes (HEX, no checksum or line ending).
- «Export list» / «Import list» move only the command list as a JSON file (to another PC or another PortDock program). When importing into a non-empty list, choose «Append» or «Replace list» in place; «Undo» works afterwards too.
RX checksum
- Pick a type to check the trailing checksum of each datagram and mark it «OK» or «FAIL».
- The checksum must be the last bytes of the datagram; a trailing CR/LF makes it «FAIL».
- The file log gets «[OK]» or «[CHECK FAIL]».
Log and event lines (EV)
- EV lines are events: start, stop, multicast join, echo on/off, errors.
- «ICMP port unreachable»: the OS reports that nobody listens at the destination. Check the device port and power.
- Above the line limit (default 100,000) old lines are removed from the screen only; file logs are unaffected.
- TRIGGER «name»: a trigger matched (may end with «— repeat stopped» / «— file log stopped»). Screen only.
- REPEAT done (n sent): the repeat count was reached. Screen only.
- LOG NEXT new name / LOG PART 2 (prev old name): the file log was split by size or time and continues in the next file (written to both files).
- Follow: new lines are followed only while you are at the bottom. Scroll up to pause (the view stays put) — «↓ Jump to latest (n new)» appears at the bottom right. Click it, press End or scroll to the bottom to follow again. The «Auto-scroll» checkbox shows whether it is following.
- Selecting: click a line, Shift+click for a range, Ctrl+click to add or remove one. Clicking does not stop following.
- Right-click menu: Copy lines · Copy HEX · Copy ASCII · Copy HEX + ASCII · Copy as C array ({0x01, 0x03}) · Send again (TX lines — exactly those bytes) · Add to commands · Find this. Data copies (HEX, ASCII, C array) skip event lines (EV), one frame per line.
Find and filter the log
The row just below the toolbar finds and filters log lines. Filtering only changes the view — nothing is deleted, and the file log is not affected.
- Find box: 2-digit HEX groups such as «01 03» search bytes; anything else searches text (case-insensitive). Pick «Auto», «HEX» or «Text» next to it when ambiguous (e.g. «0A»). Event lines (EV) are searched by their description in text mode.
- Matches are highlighted; ▲/▼ (or Enter/Shift+Enter) select the previous/next match. «3/17» means the third of 17 matches («–/17» when the selected line is not a match).
- «Matches only» shows only matching lines. «FAIL only» shows only lines whose RX checksum failed. The direction box: «All», RX, TX, EV.
- While filtering, «120 of 5,000 lines» appears on the right; ✕ turns everything off. New lines keep arriving and appear when they match.
- «CHECK FAIL n» in the toolbar counts lines with a failed checksum since the last «Clear» (shown only when there are any). Click it to toggle «FAIL only».
- Keys: Ctrl+F focuses the find box, Enter next, Shift+Enter previous, Esc clears the text (press again to clear all filters).
Saving and detail
- «Save view»: saves the lines on screen to a text file in the current «View» (HEX, ASCII, or «Both» as «HEX | ASCII»). With a filter on, only the visible lines are saved. The first line (starting with #) records the view, filter and line count. Times follow «Log timestamp» in Settings; lines with a failed checksum end with «[CHECK FAIL]». (The line format of «Log to file» follows «File log format» in Settings regardless of the view — HEX by default.)
- «Log to file»: writes every line from now on to a file, with the settings on the first line. «Stop logging» ends it. Available only while running.
- Click a log line to see its peer, length, HEX and ASCII in «Detail».
Settings (⚙)
- Language, theme, font size, timestamp format, line limit, initial auto-scroll.
- «Start file log automatically»: with an auto-log folder, each start writes «portdock-udp-date-time.log».
- «Ask before closing while connected or logging».
- «Export settings» / «Import settings» move display settings and commands as JSON. «Reset to defaults» resets display settings only.
- «Always on top»: keeps this window above other windows (same as 📌 in the header).
- «Expand all (expert view)»: shows the groups that are normally collapsed (advanced connection, receive settings, fault injection, statistics, scan options, triggers, auto-reply …) open. Folding one while it is on lasts only for this run. Turning it off returns each group to its remembered state.
Shortcuts and tips
- F4: start / stop (same as the button on the left).
- Ctrl+L: clear the on-screen log (file logs are kept).
- Ctrl+S: save view.
- Ctrl+Shift+L: start / stop logging to file.
- Esc: stop repeat sending (outside text boxes — inside a box Esc keeps its own meaning).
- End: jump to the latest log line and follow again.
- Ctrl+C: copy the selected log lines as «time direction data» (in the current view). Inside a text box it copies normally.
- Ctrl+F: focus the log find box. In it, Enter next, Shift+Enter previous, Esc clear.
- F1 or the ? button: this help. Close it with Esc.
- Number boxes: ↑/↓ by 1, Shift+↑/↓ by 10, PageUp/PageDown by 100, or the mouse wheel once the box is focused. The baud box steps through the listed rates.
- Shortcuts are ignored while a dialog or the right-click menu is open, or while composing Korean text.
- ↑/↓ in the send box: recall earlier sends (history).
- F2, F3, F5–F12: send the command with that key (the «Key» box in the command list).
- Enter in the input: send.
- Hover over a field to see a tooltip.
- Not sure where the device sends? Start on the right listen port and watch «Senders».
Input history and command hotkeys
- ↑/↓ in the send box recall earlier sends (last 50, with their HEX/ASCII mode). Sending the same thing again just moves it to the end. History is kept across restarts.
- Your unsent edit is never lost — it is set aside on the first ↑ and comes back with ↓ at the bottom. ↑/↓ do nothing while composing Korean text.
- Only sends from the «Send» button and Enter in the box are remembered (not repeat, commands or Send again).
- Command hotkeys: pick F2, F3 or F5–F12 in a command's «Key» box to send it with that key (works even while typing in the send box). F1 (help) and F4 (connect) are reserved; keys used by another command show greyed out as «F7 — «name»».
- Hotkeys are saved in exported command lists. Duplicated commands get no key, and keys already in use are dropped on import. Hotkeys are ignored while a dialog or the right-click menu is open.
Time gap column, throughput and repeat count
- «Time gap column» in the toolbar's «View options»: «Gap from previous line» shows the time since the previous RX/TX line (+12 ms); «Response time (TX→RX)» the time from the last TX to this RX. It appears next to the time and is included in line copies (Ctrl+C) and «Save view». Event lines (EV) stay empty.
- Times have 1 ms resolution and include USB adapter / OS delivery delays (a few ms); use an oscilloscope for exact device timing.
- Right side of the status line: «RX 1.2 KB/s · TX 0 B/s» is the throughput over the last second, «frames 120/30» the lines received/sent since «Clear», and «last RX 3 s ago» the time of the last reception. It turns red after 10 s of silence while running.
- The «times» box next to «Repeat (ms)»: repeat stops by itself after that many sends (0 = until turned off). «sent 3/10» shows progress, and «REPEAT done (10 sent)» is added as an event line (screen only).
Triggers
Open «Triggers» in the right pane and click «+ Trigger». When a received line (RX) contains the pattern, the chosen actions run.
- Pattern — HEX: «01 03 ?? **» (?? = any byte, ** = zero or more bytes). ASCII: e.g. «ALARM*» (? = any byte, * = zero or more, \r \n \xNN escapes, a literal ? is \x3F). Matches anywhere in the line, case-sensitive — the same rules as an auto-reply rule with «Wildcards» on.
- Actions: «Color» (pick a color) · «Beep» · «Stop repeat» · «Stop log» (turns off Log to file) · «Event line» (an EV line «TRIGGER «name»») · «Flash» (flashes the taskbar when the window is in the background). Stopping repeat or logging is noted in the event line too.
- Each trigger shows its hit count (e.g. «3×»), the header the total. «Reset counts» starts again from 0. Unchecking pauses one trigger; deleting can be undone for 5 seconds.
- Triggers run on screen only (colors and event lines are not written to the file log). The list is kept across restarts.
Checksum options, CRC-32 and custom CRC
Click ⚙ next to the checksum in the send bar or in «Verify RX checksum» to open the options. ⚙• means options are on.
- «Leading bytes left out of the calculation»: leaves a header such as STX or an address out.
- «Insert this many bytes before the end»: puts the checksum m bytes before the end (before ETX etc.); those m bytes are left out of the calculation too. Example: «\x02AB\x03» + BCC, skip 1, before end 1 → 02 41 42 [03] 03. The line ending (CR LF) is still appended at the very end.
- «Reverse byte order»: swaps 2- and 4-byte checksums. By default CRC16 Modbus and CRC-32 are low byte first; CCITT, XMODEM, SUM16 and custom CRC high byte first.
- RX verification uses the same options — it skips the first n bytes and compares the checksum m bytes before the end (the terminator is removed first in terminator mode).
- «CRC-32»: ISO-HDLC (as in zip/Ethernet), 4 bytes. «CRC (custom)»: width 8/16/32, poly, init, xorout (HEX), refin and refout exactly as in the reveng catalogue. «Preset» offers CRC-16/ARC, KERMIT, X.25, DNP, CRC-32/MPEG-2, CRC-32C and more. Values that do not fit the width are flagged in red and nothing is sent.
- Checksum options are saved and exported with commands.
Text encoding and file log format
The «Text and file log» part of Settings (⚙).
- «Text encoding»: UTF-8 (default), CP949 (EUC-KR), Latin-1, ASCII. Used for the ASCII view, copies and saves, and for characters sent in ASCII mode. Bytes the encoding cannot read appear as «<C7>», control characters as «<CR>». If a character to send is not in the encoding, «Bytes to send» explains why and nothing is sent (\xNN escapes always give that byte). Korean text in the log search is matched as UTF-8 bytes — search CP949 lines in HEX.
- «File log format»: HEX (as before), ASCII (text), HEX + ASCII, or CSV (for Excel: «ts,dir,len,hex,ascii,check,note,peer», UTF-8 BOM). CSV cells starting with = + - @ get a leading ' so Excel does not treat them as formulas. With CSV the save dialog suggests a .csv name.
- «Split by size (MB)» / «Split by time (hours)»: logging continues in «name-002.log», «name-003.log» … The old file ends with «LOG NEXT new name» and the new one starts with «LOG PART 2 (prev old name)». 0 means never split.
- Format and splitting apply from the next file log you start (the current file is unchanged).
This PC's addresses, multicast NIC, TTL
- Click «Bind address» to pick one of this PC's adapter addresses or 0.0.0.0 (all adapters), or click one under «This PC» on the left (↻ reloads). An address that is not on this PC is flagged before you start.
- When a multicast group is set or «Destination (default)» is a multicast address (224–239.x.x.x), more fields appear.
- «Multicast NIC»: the adapter used to join the group and to send multicast (pick from the list). 0.0.0.0 lets Windows choose — with several adapters (office + machine network) pick the machine side.
- «Multicast TTL» (1–255, default 1): how many routers multicast may cross. 1 = this network only.
- «Receive our own multicast on this PC» (on by default): when off, programs on this PC that joined the group (this window included) do not receive what we send.
- On start the event line shows the real setup, e.g. «BIND … multicast 239.0.0.1 if 192.168.0.10 ttl 4 noloop». If the port is already in use, the program and PID holding it are shown.
Auto reply
«▸ Auto reply» in the right pane answers received lines with the same rules as Simulator — no separate device simulator needed.
- «On» in its header turns it on or off (green when on). Rules are kept while off and reply as soon as it is on. Rules, the switch and match options survive restarts.
- A rule: «When» pattern (HEX/ASCII, «exact»/«contains», HEX wildcards ??/**) → «Reply» (checksum, line ending, delay). The first matching rule replies, and every reply is logged as «AUTO name».
- ASCII patterns compare literally (the default for new rules — SCPI «*IDN?» as is). Turn on a rule's «Wildcards» to make ? any one character and * zero or more. Rules saved before 10/18 load with it on, so they behave as before.
- With no rules, the [Modbus RTU 03 reply] [SCPI *IDN? reply] [Echo] example buttons give you a start. A new rule takes the format of the rule above it (HEX/ASCII, exact/contains, reply format, line ending).
- «Ignore line ending when matching» strips the framing terminator and CR/LF before comparing. «Log unmatched requests (NO MATCH)» logs «NO MATCH — closest: name» when no rule matches.
- Replies go back to the sender (TCP server: that connection; UDP: the sender's address). If our own reply comes straight back, it is not answered again, so endless ping-pong cannot start.
- The number on each card is its reply count; «Reset counts» sets it to 0. An invalid rule turns red and only that rule is skipped.
- This is a simple auto reply riding on the connection. For many rules or device emulation (unsolicited sends and fault emulation included) use PortDock Simulator — a note under the panel says so too.
Reply templates ({…} fields)
A reply may contain {…} fields that are filled for every request. They work in HEX and ASCII, and «Insert field» next to the reply puts one at the cursor.
- {req} whole request · {req 0..1} request bytes 0–1 (inclusive) · {req 6} one byte · {req 2..} byte 2 to the end · {req -2..-1} the last 2 bytes (negative counts from the end, -1 = last).
- {counter} how many times this rule has replied (from 0), 1 byte · {counter 2} / {counter 4} size in bytes · add le for little-endian (default big-endian) · {counter dec} decimal text. «Reset counts» starts over at 0.
- {rand 0..100} random value in the range (inclusive; size 1/2/4 bytes to fit the max) · {rand 0..1000 2 le} explicit size and order · {rand 10..99 dec} decimal text.
- {time} current time «HH:MM:SS» as text · {time %Y-%m-%d %H:%M:%S} custom format · {unix} Unix seconds · {unix ms} milliseconds.
- {crc kind} checksum of all bytes before this field, placed here · {crc bcc 1..-1} explicit range (counted over the reply without checksum fields) · add swap to reverse the byte order. Kinds: crc16-modbus, crc16-ccitt, crc16-xmodem, crc8, lrc, bcc, sum8, sum16, crc32.
- Order: fill fields → {crc} fields → the rule's «Checksum» (over everything) → «Line ending». So «01 03 02 {req 4..5}» with checksum CRC16 Modbus equals «01 03 02 {req 4..5} {crc crc16-modbus}».
- Example — Modbus TCP read of 2 holding registers: when «?? ?? 00 00 00 06 ?? 03 **», reply «{req 0..1} 00 00 00 07 {req 6} 03 04 00 64 00 C8». The transaction ID (bytes 0–1) and MBAP Unit ID (byte 6, the Slave ID) are echoed so the master can pair them. MBAP has no CRC, so set checksum to «None».
- Example — a device with sequence numbers: «ACK {counter dec}\r\n» (ASCII). Example — BCC after STX…ETX: «02 {req 1..-2} 03 {crc bcc 1..-1}».
- If a request is too short for a field such as {req 9}, nothing is sent and the log shows «AUTO name — request range …». A { that does not start a known name (req, counter, rand, time, unix, crc) is sent as is (e.g. {"ok":1}). To send text like «{req» literally, write \x7B in ASCII.
- Type a request into «Sample request» under «More» (same HEX/ASCII as the pattern) to see whether it matches and the exact reply bytes. It is filled with count 0 and sample random values, so real values differ.
Fault injection and rotating replies
Expand «▸ More» on a rule card to test the host's timeout, retry and state handling. Active options are always shown as small tags under the card («delay 10–50 ms», «drop 1 in 3», …).
- «Delay range»: replies after a random delay between the start and end (ms) every time (jitter). If the end is not above the start, the start is a fixed delay. The log shows the real delay, e.g. «AUTO name +37ms».
- «drop every Nth request»: the Nth, 2Nth … requests matching this rule get no answer (0 = off). «% = drop by chance» drops with that probability. Dropped requests are logged as «DROP name — …» and do not count as replies.
- «Rotate replies»: with several replies («+ Add reply»), each match sends the next one «in sequence» (1 → 2 → … → 1) or a «random» one — to mimic a device whose state changes (idle → running → done). The log shows which, e.g. «AUTO name [2/3]».
- «In sequence» and {counter} use the rule's reply count — «Reset counts» starts over. Editing a rule (same name) keeps counting.
Troubleshooting
- «Address in use» at start: another program uses the port. Pick another port or close that program.
- Nothing arrives: check the device's destination IP/port, the Windows Firewall prompt, and that both are on the same subnet.
- Error when sending a broadcast: enable «Allow broadcast» and restart.
- No multicast: check the group address and «Multicast NIC», then press «Rejoin».
- The program does not open: Microsoft Edge WebView2 is required (included in Windows 11).