Skip to content

RF Sentinel (RFSentinel): free, open-source police detector app for Android. Spots police body cams, Flock ALPR cameras, AirTag trackers, Remote ID drones, smart glasses and fake cell towers from Bluetooth LE and WiFi. No root.

Network SDR: use an rtl_tcp server over WiFi when no USB SDR is plugged in

CIS-C03ef9a8ebba81
diff --git a/app/src/main/java/com/rfsentinel/app/sdr/RtlTcp.kt b/app/src/main/java/com/rfsentinel/app/sdr/RtlTcp.kt
new file mode 100644
index 0000000..b364748
--- /dev/null
+++ b/app/src/main/java/com/rfsentinel/app/sdr/RtlTcp.kt
@@ -0,0 +1,162 @@
+package com.rfsentinel.app.sdr
+
+import java.io.IOException
+import java.io.InputStream
+import java.io.OutputStream
+import java.net.InetSocketAddress
+import java.net.Socket
+import java.net.SocketTimeoutException
+
+/**
+ * An RTL-SDR on another device, over WiFi: the rtl_tcp protocol (librtlsdr's rtl_tcp.c, also served by
+ * ESP32 boards). The server opens with a 12-byte header ("RTL0", tuner type, gain count) and then streams
+ * the same unsigned 8-bit I/Q as a USB dongle; each command is 1 byte plus a big-endian 32-bit value.
+ * Receive only: nothing here makes the server transmit.
+ */
+class RtlTcp(private val host: String, private val port: Int, private val log: (String) -> Unit) : SdrDevice {
+
+ override val label = "Network SDR"
+ override var sampleRate = 0; private set
+ override var ctlErrors = 0; private set
+ @Volatile override var lost = false; private set
+ override val tunerWriteFails = 0
+ override val settleReads = 2
+
+ private var socket: Socket? = null
+ private var input: InputStream? = null
+ private var output: OutputStream? = null
+ /** An odd byte left over from a read cut short: kept so I and Q never swap. */
+ private var pending = -1
+
+ override fun open(): Boolean {
+ val s = Socket()
+ try {
+ s.connect(InetSocketAddress(host, port), CONNECT_MS)
+ s.soTimeout = READ_MS
+ s.tcpNoDelay = true
+ s.receiveBufferSize = 1 shl 20
+ socket = s; input = s.getInputStream(); output = s.getOutputStream()
+ val h = ByteArray(HEADER)
+ if (fill(h, 0, HEADER) < HEADER || String(h, 0, 4, Charsets.US_ASCII) != "RTL0") {
+ log("Network SDR: $host:$port doesn't answer like an rtl_tcp server")
+ return fail()
+ }
+ log("Network SDR: connected to $host:$port, tuner ${TUNERS[be32(h, 4)] ?: "type ${be32(h, 4)}"}, ${be32(h, 8)} gain steps")
+ } catch (e: IOException) {
+ log("Network SDR: can't connect to $host:$port (${e.javaClass.simpleName})")
+ return fail()
+ }
+ command(AGC, 0)
+ command(BIAS_TEE, 0) // no power on the antenna port
+ setSampleRate(2_048_000)
+ setGain(297)
+ tune(100_000_000L)
+ return !lost
+ }
+
+ private fun fail(): Boolean { lost = true; close(); return false }
+
+ override fun close() {
+ runCatching { socket?.close() }
+ socket = null; input = null; output = null
+ }
+
+ /** librtlsdr picks the nearest rate the dongle can make; close enough for the spectrum. */
+ override fun setSampleRate(rate: Int) {
+ if (command(SAMPLE_RATE, rate)) sampleRate = rate
+ }
+
+ /** Tunes to [hz]; the server doesn't say whether the PLL locked, so only the tuner's range is checked. */
+ override fun tune(hz: Long): Boolean {
+ if (hz !in MIN_HZ..MAX_HZ || !command(FREQUENCY, hz.toInt())) return false
+ // shortcut: skips a fixed amount for the samples still on their way from before the retune (~50 ms at 2 MS/s); measure the round trip if sweeps over slow WiFi still show the old frequency.
+ skip(available() + STALE_BYTES)
+ return true
+ }
+
+ /** Fixed tuner gain in tenths of a dB; the server rounds it to the tuner's nearest step. */
+ override fun setGain(tenthsDb: Int) {
+ command(GAIN_MODE, 1)
+ command(GAIN, tenthsDb)
+ }
+
+ /** Drops what has already arrived, so the next read is fresh. */
+ override fun resetBuffer() = skip(available())
+
+ /** Fills [buf] with I/Q; fewer bytes (always an even count) if the stream stalls, -1 when nothing came or the link is gone. */
+ override fun read(buf: ByteArray, len: Int): Int {
+ if (lost || len < 2) return -1
+ var got = 0
+ if (pending >= 0) { buf[0] = pending.toByte(); pending = -1; got = 1 }
+ got += fill(buf, got, len - got)
+ if (got % 2 == 1) pending = buf[--got].toInt() and 0xff
+ return if (got > 0) got else -1
+ }
+
+ /** Reads up to [len] bytes into [buf] at [off]; stops early on a timeout, marks [lost] when the link drops. */
+ private fun fill(buf: ByteArray, off: Int, len: Int): Int {
+ val inp = input ?: return 0
+ var got = 0
+ try {
+ while (got < len) {
+ val n = inp.read(buf, off + got, len - got)
+ if (n < 0) { lost = true; break }
+ got += n
+ }
+ } catch (_: SocketTimeoutException) {
+ } catch (_: IOException) {
+ lost = true
+ }
+ return got
+ }
+
+ /** Bytes already received, rounded down to whole samples. */
+ private fun available(): Int = runCatching { input?.available() ?: 0 }.getOrDefault(0) and 1.inv()
+
+ private fun skip(bytes: Int) {
+ val scratch = ByteArray(16_384)
+ var left = bytes - if (pending >= 0) 1 else 0
+ pending = -1
+ while (left > 0 && !lost) {
+ val n = fill(scratch, 0, minOf(left, scratch.size))
+ if (n == 0) break
+ left -= n
+ }
+ }
+
+ private fun command(cmd: Int, value: Int): Boolean {
+ val out = output ?: return false
+ val b = byteArrayOf(cmd.toByte(), (value ushr 24).toByte(), (value ushr 16).toByte(), (value ushr 8).toByte(), value.toByte())
+ return try { out.write(b); out.flush(); true } catch (_: IOException) { ctlErrors++; lost = true; false }
+ }
+
+ companion object {
+ const val DEFAULT_PORT = 1234
+ private const val HEADER = 12
+ private const val CONNECT_MS = 5_000
+ private const val READ_MS = 2_000
+ internal const val STALE_BYTES = 262_144 // one rtl_tcp buffer
+ private const val MIN_HZ = 24_000_000L
+ private const val MAX_HZ = 1_766_000_000L
+ internal const val FREQUENCY = 0x01
+ internal const val SAMPLE_RATE = 0x02
+ internal const val GAIN_MODE = 0x03
+ internal const val GAIN = 0x04
+ internal const val AGC = 0x08
+ internal const val BIAS_TEE = 0x0e
+ private val TUNERS = mapOf(1 to "E4000", 2 to "FC0012", 3 to "FC0013", 4 to "FC2580", 5 to "R820T", 6 to "R828D")
+
+ private fun be32(b: ByteArray, at: Int) =
+ ((b[at].toInt() and 0xff) shl 24) or ((b[at + 1].toInt() and 0xff) shl 16) or ((b[at + 2].toInt() and 0xff) shl 8) or (b[at + 3].toInt() and 0xff)
+
+ /** "host" or "host:port" from Settings; null when empty or the port isn't a number. */
+ fun parse(address: String): Pair<String, Int>? {
+ val a = address.trim()
+ if (a.isEmpty() || a.any { it.isWhitespace() }) return null
+ val colon = a.lastIndexOf(':')
+ if (colon < 0) return a to DEFAULT_PORT
+ val port = a.substring(colon + 1).toIntOrNull()?.takeIf { it in 1..65535 } ?: return null
+ return a.substring(0, colon).takeIf { it.isNotEmpty() }?.let { it to port }
+ }
+ }
+}
diff --git a/app/src/main/java/com/rfsentinel/app/sdr/SdrRadio.kt b/app/src/main/java/com/rfsentinel/app/sdr/SdrRadio.kt
index 0c8fee3..322a49b 100644
--- a/app/src/main/java/com/rfsentinel/app/sdr/SdrRadio.kt
+++ b/app/src/main/java/com/rfsentinel/app/sdr/SdrRadio.kt
@@ -28,6 +28,8 @@ object SdrRadio {
private const val ACTION_PERMISSION = "com.rfsentinel.app.SDR_PERMISSION"
private const val SAMPLE_RATE = 2_048_000
private const val GAIN_TENTHS_DB = 297
+ private const val NET = "net:" // runningDevice of a network SDR
+ private const val NET_RETRY_MS = 10_000L
private const val XFER = 16_384 // bytes per USB read (8192 samples)
private const val READS_PER_CHUNK = 8 // ~32 ms of samples per tuned chunk
private const val TETRA_READS = 16 // ~64 ms: more than one TETRA frame, so a radio's slot is always in it
@@ -178,8 +180,8 @@ object SdrRadio {
/** "RTL-SDR unplugged" stays a little, then leaves the hardware status (unless it came back). */
private fun clearUnpluggedSoon() = main.postDelayed({ if (status == UNPLUGGED) status = "" }, 15_000L)
- /** Whether the dongle [name] is no longer plugged in (no unplug notice needed). */
- private fun gone(name: String): Boolean =
+ /** Whether the dongle [name] is no longer plugged in (no unplug notice needed). A network SDR never is: its socket says when it's lost. */
+ private fun gone(name: String): Boolean = !name.startsWith(NET) &&
runCatching { usb?.deviceList?.values?.none { it.deviceName == name } }.getOrNull() == true
private fun deviceOf(intent: Intent): UsbDevice? =
@@ -191,15 +193,25 @@ object SdrRadio {
private fun connect(context: Context, ask: Boolean = true) {
val mgr = context.getSystemService(UsbManager::class.java) ?: return
usb = mgr
+ val all = runCatching { mgr.deviceList.values.toList() }.getOrDefault(emptyList())
+ val d = com.rfsentinel.app.usb.UsbPick.pick(context, com.rfsentinel.app.usb.UsbPick.Kind.SDR, all)
runningDevice?.let { name ->
- if (!gone(name)) return
- // Unplugged without the system saying so: let that one go so the dongle can start again.
- UsbWifi.log("$deviceLabel: $name is gone - starting over")
- halt("")
+ if (name.startsWith(NET)) {
+ if (d == null) return
+ // A plugged-in SDR takes over from the network one.
+ UsbWifi.log("$deviceLabel: a USB SDR is plugged in - using it instead")
+ halt("")
+ } else {
+ if (!gone(name)) return
+ // Unplugged without the system saying so: let that one go so the dongle can start again.
+ UsbWifi.log("$deviceLabel: $name is gone - starting over")
+ halt("")
+ }
}
- val all = runCatching { mgr.deviceList.values.toList() }.getOrDefault(emptyList())
- val d = com.rfsentinel.app.usb.UsbPick.pick(context, com.rfsentinel.app.usb.UsbPick.Kind.SDR, all) ?: run {
- com.rfsentinel.app.usb.UsbPick.waitingFor(context, com.rfsentinel.app.usb.UsbPick.Kind.SDR, all)?.let {
+ if (d == null) {
+ val net = RtlTcp.parse(com.rfsentinel.app.util.Prefs.networkSdr(context))
+ if (net != null) connectNet(net.first, net.second)
+ else com.rfsentinel.app.usb.UsbPick.waitingFor(context, com.rfsentinel.app.usb.UsbPick.Kind.SDR, all)?.let {
status = "SDR: waiting for $it, picked in Settings"
}
return
@@ -214,25 +226,52 @@ object SdrRadio {
return
}
val conn = mgr.openDevice(d) ?: run { status = "$deviceLabel: couldn't open it"; return }
- runningDevice = d.deviceName
+ launch(d.deviceName, "%04x:%04x".format(d.vendorId, d.productId), { conn.close() }) {
+ if (HackRf.isHackRf(d.vendorId, d.productId)) HackRf(conn, d, UsbWifi::log) else RtlSdr(conn, d, UsbWifi::log)
+ }
+ }
+
+ /** Settings › Network SDR: an rtl_tcp server, used while no USB SDR is plugged in. */
+ private fun connectNet(host: String, port: Int) {
+ deviceLabel = "Network SDR · $host"
+ launch("$NET$host:$port", "$host:$port", {}) { RtlTcp(host, port, UsbWifi::log) }
+ }
+
+ /** Settings › Network SDR changed: a moment after the typing stops, drop the old server and try the new one. */
+ fun networkChanged() {
+ main.removeCallbacks(reconnectNet)
+ main.postDelayed(reconnectNet, 2_000L)
+ }
+ private val reconnectNet = Runnable {
+ synchronized(this) {
+ if (runningDevice?.startsWith(NET) == true) halt("")
+ if (receiver != null) appContext?.let { connect(it) }
+ }
+ }
+
+ /** Reads [name] on a new thread made by [open]; [release] frees it once the thread is done. */
+ private fun launch(name: String, intro: String, release: () -> Unit, open: () -> SdrDevice) {
+ runningDevice = name
stop = false
status = "$deviceLabel · starting…"
+ val net = name.startsWith(NET)
val t = Thread({
- val sdr: SdrDevice = if (HackRf.isHackRf(d.vendorId, d.productId)) HackRf(conn, d, UsbWifi::log) else RtlSdr(conn, d, UsbWifi::log)
- val result = runCatching { run(sdr, d) }
+ val sdr = open()
+ val result = runCatching { run(sdr, name, intro) }
val failure = result.exceptionOrNull()
- runCatching { conn.close() }
+ if (net) sdr.close()
+ runCatching { release() }
synchronized(this) {
if (worker !== Thread.currentThread()) return@synchronized
worker = null
runningDevice = null
// Never leave the last "live" line behind: unplugged, failed, or just stopped answering.
- if (gone(d.deviceName) || result.getOrNull() == true) {
- UsbWifi.log("$deviceLabel: unplugged or not answering")
- status = UNPLUGGED
- clearUnpluggedSoon()
- // Plugged back in already (it gets a new name), or it was only stuck: try again shortly.
- appContext?.let { main.postDelayed({ if (receiver != null) connect(it) }, 3_000L) }
+ if (gone(name) || result.getOrNull() == true) {
+ UsbWifi.log("$deviceLabel: ${if (net) "can't reach it" else "unplugged or not answering"}")
+ status = if (net) "$deviceLabel: can't connect, retrying" else UNPLUGGED
+ if (!net) clearUnpluggedSoon()
+ // Plugged back in (it gets a new name), only stuck, or the network server may be back: try again shortly.
+ appContext?.let { main.postDelayed({ if (receiver != null) connect(it) }, if (net) NET_RETRY_MS else 3_000L) }
} else if (failure != null) {
UsbWifi.log("$deviceLabel stopped: ${UsbWifi.describe(failure)}")
status = "$deviceLabel error: ${failure.message}"
@@ -244,18 +283,18 @@ object SdrRadio {
}
/** Reads until stopped; true when it ended because the dongle went away (unplugged or not answering). */
- private fun run(sdr: SdrDevice, d: UsbDevice): Boolean {
- UsbWifi.log("=== $deviceLabel radio activity watch (%04x:%04x) ===".format(d.vendorId, d.productId))
+ private fun run(sdr: SdrDevice, name: String, intro: String): Boolean {
+ UsbWifi.log("=== $deviceLabel radio activity watch ($intro) ===")
if (!sdr.open()) {
- if (sdr.lost || gone(d.deviceName)) return true
+ if (sdr.lost || gone(name)) return true
status = if (sdr is HackRf) "HackRF: couldn't start it (see the USB log)"
else "RTL-SDR: this tuner isn't supported yet (R820T / R820T2 / R860 / R828D only)"
return false
}
sweepWatch = null; p25Hunt = null; p25Lock = null
var tuned = false
- while (!halted && !sdr.lost && !gone(d.deviceName)) {
- if (tuneHz != null) { runTuned(sdr, d.deviceName); tuned = true; continue }
+ while (!halted && !sdr.lost && !gone(name)) {
+ if (tuneHz != null) { runTuned(sdr, name); tuned = true; continue }
// Back from the waterfall: the scan it interrupted gets its turn again, not the next one.
val m = mode?.takeIf { tuned && it in modes } ?: next()
tuned = false
@@ -267,13 +306,13 @@ object SdrRadio {
if (modes.size > 1) UsbWifi.log("$deviceLabel: turn: ${m.label} for ${turnMs / 1000} s")
mode = m; turnEnd = System.currentTimeMillis() + turnMs
when (m) {
- Mode.SWEEP -> runSweep(sdr, d.deviceName)
- Mode.ADSB -> runAdsb(sdr, d.deviceName)
- Mode.P25 -> runP25(sdr, d.deviceName)
+ Mode.SWEEP -> runSweep(sdr, name)
+ Mode.ADSB -> runAdsb(sdr, name)
+ Mode.P25 -> runP25(sdr, name)
}
}
if (sdr.lost) UsbWifi.log("$deviceLabel: the dongle stopped answering (unplugged?)")
- val away = sdr.lost || gone(d.deviceName)
+ val away = sdr.lost || gone(name)
if (!away) sdr.close()
return away && !halted
}
diff --git a/app/src/main/java/com/rfsentinel/app/settings/SettingsActivity.kt b/app/src/main/java/com/rfsentinel/app/settings/SettingsActivity.kt
index b1e9462..69b3617 100644
--- a/app/src/main/java/com/rfsentinel/app/settings/SettingsActivity.kt
+++ b/app/src/main/java/com/rfsentinel/app/settings/SettingsActivity.kt
@@ -1404,6 +1404,24 @@ class SettingsActivity : AppCompatActivity() {
setOnCheckedChangeListener { _, v -> save(v) }
}.also { box.addView(if (info == null) it else infoRow(it, info)) }
+ info(label("Network SDR"), "Uses an RTL-SDR on another device over WiFi, such as an ESP32 board or a computer running " +
+ "rtl_tcp. Enter its address and port; the port is ${com.rfsentinel.app.sdr.RtlTcp.DEFAULT_PORT} if left out. A plugged-in " +
+ "USB SDR is used first. Streaming takes about 5 MB/s of WiFi.", "Network SDR")
+ box.addView(android.widget.EditText(this).apply {
+ setText(Prefs.networkSdr(this@SettingsActivity)); hint = "192.168.4.1:1234"
+ isSingleLine = true
+ inputType = android.text.InputType.TYPE_CLASS_TEXT or android.text.InputType.TYPE_TEXT_VARIATION_URI
+ importantForAutofill = View.IMPORTANT_FOR_AUTOFILL_NO
+ addTextChangedListener(object : android.text.TextWatcher {
+ override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {}
+ override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {}
+ override fun afterTextChanged(s: android.text.Editable?) {
+ Prefs.setNetworkSdr(this@SettingsActivity, s?.toString().orEmpty().trim())
+ com.rfsentinel.app.sdr.SdrRadio.networkChanged()
+ }
+ })
+ })
+
// What the SDR does: any mix; with more than one ticked it takes turns.
var showSdrOptions: () -> Unit = {}
info(label("Scan with the SDR"), "Tick what the RTL-SDR or HackRF does while scanning. One SDR hears one thing at a time: " +
diff --git a/app/src/main/java/com/rfsentinel/app/util/Prefs.kt b/app/src/main/java/com/rfsentinel/app/util/Prefs.kt
index dcbe9f3..3a75aad 100644
--- a/app/src/main/java/com/rfsentinel/app/util/Prefs.kt
+++ b/app/src/main/java/com/rfsentinel/app/util/Prefs.kt
@@ -618,6 +618,9 @@ object Prefs {
private val TETRA_REGIONS = setOf("AT", "BE", "BG", "CH", "CY", "CZ", "DE", "DK", "EE", "ES", "FI", "FR", "GB", "GR", "HR",
"HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MT", "NL", "NO", "PL", "PT", "RO", "SE", "SI", "SK")
fun setRadioBandsOff(context: Context, v: Set<String>) = sp(context).edit { putStringSet("radio_bands_off", v) }
+ /** Settings › Network SDR: an rtl_tcp server as "host" or "host:port"; empty = off. */
+ fun networkSdr(context: Context) = str(context, "network_sdr")
+ fun setNetworkSdr(context: Context, v: String) = setStr(context, "network_sdr", v)
/** The user's own bands, one "start-end MHz label" per line. */
fun radioCustomBands(context: Context) = str(context, "radio_custom_bands")
fun setRadioCustomBands(context: Context, v: String) = setStr(context, "radio_custom_bands", v)
diff --git a/app/src/test/java/com/rfsentinel/app/sdr/RtlTcpTest.kt b/app/src/test/java/com/rfsentinel/app/sdr/RtlTcpTest.kt
new file mode 100644
index 0000000..6617248
--- /dev/null
+++ b/app/src/test/java/com/rfsentinel/app/sdr/RtlTcpTest.kt
@@ -0,0 +1,77 @@
+package com.rfsentinel.app.sdr
+
+import org.junit.Assert.assertArrayEquals
+import org.junit.Assert.assertEquals
+import org.junit.Assert.assertFalse
+import org.junit.Assert.assertNull
+import org.junit.Assert.assertTrue
+import org.junit.Test
+import java.io.DataInputStream
+import java.net.ServerSocket
+import kotlin.concurrent.thread
+
+class RtlTcpTest {
+
+ private fun cmd(c: Int, v: Int) = listOf(c, v)
+
+ @Test
+ fun opensSendsCommandsAndKeepsIqAligned() {
+ val server = ServerSocket(0)
+ val got = mutableListOf<List<Int>>()
+ val iq = ByteArray(1000) { it.toByte() }
+ val t = thread {
+ server.accept().use { s ->
+ val out = s.getOutputStream()
+ out.write("RTL0".toByteArray() + byteArrayOf(0, 0, 0, 5, 0, 0, 0, 29)); out.flush()
+ val inp = DataInputStream(s.getInputStream())
+ // AGC, bias-T, rate, gain mode, gain, frequency.
+ repeat(6) { got += cmd(inp.readUnsignedByte(), inp.readInt()) }
+ // After the retune: the stale samples it skips, then the stream in an odd split (333 bytes, a pause, the rest).
+ Thread.sleep(300)
+ out.write(ByteArray(RtlTcp.STALE_BYTES) { 0x7f }); out.write(iq, 0, 333); out.flush()
+ Thread.sleep(2_500) // longer than the read timeout: the first read comes back short, on an odd byte
+ out.write(iq, 333, iq.size - 333); out.flush()
+ Thread.sleep(500)
+ }
+ }
+ val sdr = RtlTcp("127.0.0.1", server.localPort) {}
+ assertTrue(sdr.open())
+ assertEquals(-1, sdr.read(ByteArray(4), 1))
+ val buf = ByteArray(1000)
+ var n = 0
+ while (n < iq.size) {
+ val part = ByteArray(400)
+ val k = sdr.read(part, part.size)
+ assertTrue("reads are whole samples", k > 0 && k % 2 == 0)
+ System.arraycopy(part, 0, buf, n, k); n += k
+ }
+ assertArrayEquals(iq, buf)
+ t.join(); server.close()
+ assertEquals(listOf(
+ cmd(RtlTcp.AGC, 0), cmd(RtlTcp.BIAS_TEE, 0), cmd(RtlTcp.SAMPLE_RATE, 2_048_000),
+ cmd(RtlTcp.GAIN_MODE, 1), cmd(RtlTcp.GAIN, 297), cmd(RtlTcp.FREQUENCY, 100_000_000)), got)
+ assertEquals(2_048_000, sdr.sampleRate)
+ assertFalse(sdr.tune(5_000_000_000L))
+ sdr.close()
+ }
+
+ @Test
+ fun notAnRtlTcpServerIsLost() {
+ val server = ServerSocket(0)
+ val t = thread { server.accept().use { it.getOutputStream().write("HTTP/1.1 200".toByteArray()); Thread.sleep(200) } }
+ val sdr = RtlTcp("127.0.0.1", server.localPort) {}
+ assertFalse(sdr.open())
+ assertTrue(sdr.lost)
+ t.join(); server.close()
+ }
+
+ @Test
+ fun parsesTheAddress() {
+ assertEquals("1.2.3.4" to 1234, RtlTcp.parse(" 1.2.3.4 "))
+ assertEquals("h" to 99, RtlTcp.parse("h:99"))
+ assertNull(RtlTcp.parse("h:port"))
+ assertNull(RtlTcp.parse("h:70000"))
+ assertNull(RtlTcp.parse(":1234"))
+ assertNull(RtlTcp.parse(""))
+ }
+}