@foxglove/rtps
Advanced tools
Comparing version 0.1.3 to 0.2.0
@@ -16,3 +16,3 @@ /// <reference types="node" /> | ||
dropMembership(multicastAddress: string, multicastInterface?: string): Promise<void>; | ||
send(data: Uint8Array, port: number, address: string): Promise<void>; | ||
send(data: Uint8Array, offset: number, length: number, port: number, address: string): Promise<void>; | ||
setBroadcast(flag: boolean): Promise<void>; | ||
@@ -19,0 +19,0 @@ setMulticastInterface(multicastInterface: string): Promise<void>; |
@@ -52,5 +52,5 @@ "use strict"; | ||
} | ||
async send(data, port, address) { | ||
async send(data, offset, length, port, address) { | ||
await new Promise((resolve, reject) => { | ||
this._socket.send(data, 0, data.length, port, address, (err) => { | ||
this._socket.send(data, offset, length, port, address, (err) => { | ||
if (err != undefined) { | ||
@@ -57,0 +57,0 @@ reject(err); |
@@ -39,3 +39,3 @@ export interface NetworkInterface { | ||
dropMembership(multicastAddress: string, multicastInterface?: string): Promise<void>; | ||
send(data: Uint8Array, port: number, address: string): Promise<void>; | ||
send(data: Uint8Array, offset: number, length: number, port: number, address: string): Promise<void>; | ||
setBroadcast(flag: boolean): Promise<void>; | ||
@@ -42,0 +42,0 @@ setMulticastInterface(multicastInterface: string): Promise<void>; |
@@ -47,5 +47,6 @@ "use strict"; | ||
async function sendMessageToUdp(msg, srcSocket, locators) { | ||
const data = msg.data; | ||
for (const locator of locators) { | ||
if (locator.kind === common_1.LocatorKind.UDPv4) { | ||
await srcSocket.send(msg.data, locator.port, locator.address); | ||
await srcSocket.send(data, 0, data.length, locator.port, locator.address); | ||
return; | ||
@@ -52,0 +53,0 @@ } |
{ | ||
"name": "@foxglove/rtps", | ||
"version": "0.1.3", | ||
"version": "0.2.0", | ||
"description": "Real-Time Publish Subscribe (DDS-RTPS) protocol implementation with a pluggable transport layer. This is a subset of the complete specification optimized for ROS 2 (Robot Operating System) connections", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -61,5 +61,11 @@ import dgram from "dgram"; | ||
async send(data: Uint8Array, port: number, address: string): Promise<void> { | ||
async send( | ||
data: Uint8Array, | ||
offset: number, | ||
length: number, | ||
port: number, | ||
address: string, | ||
): Promise<void> { | ||
await new Promise<void>((resolve, reject) => { | ||
this._socket.send(data, 0, data.length, port, address, (err) => { | ||
this._socket.send(data, offset, length, port, address, (err) => { | ||
if (err != undefined) { | ||
@@ -66,0 +72,0 @@ reject(err); |
@@ -44,3 +44,9 @@ export interface NetworkInterface { | ||
dropMembership(multicastAddress: string, multicastInterface?: string): Promise<void>; | ||
send(data: Uint8Array, port: number, address: string): Promise<void>; | ||
send( | ||
data: Uint8Array, | ||
offset: number, | ||
length: number, | ||
port: number, | ||
address: string, | ||
): Promise<void>; | ||
setBroadcast(flag: boolean): Promise<void>; | ||
@@ -47,0 +53,0 @@ setMulticastInterface(multicastInterface: string): Promise<void>; |
@@ -55,5 +55,6 @@ import { Locator, LocatorKind, ipv6ToBytes, ipv4ToBytes } from "../common"; | ||
): Promise<void> { | ||
const data = msg.data; | ||
for (const locator of locators) { | ||
if (locator.kind === LocatorKind.UDPv4) { | ||
await srcSocket.send(msg.data, locator.port, locator.address); | ||
await srcSocket.send(data, 0, data.length, locator.port, locator.address); | ||
return; | ||
@@ -60,0 +61,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
486961
7531