You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried to use norm to send data stream under android, it works fine, but whenever it runs continuously for a period of time, it cannot receive data, abnormal content:
NormStreamObject::WriteSegment() broken stream data not read by app!
my code:
public class NormStreamRecv {
static final long SESSION_BUFFER_SIZE = 1024 * 1024;
static final int SEGMENT_SIZE = 1400;
static final int BLOCK_SIZE = 64;
static final int PARITY_SEGMENTS = 16;
static final String DEST_ADDRESS = "239.244.0.100";
static final int DEST_PORT = 10030;
public static void start() {
NormInstance instance = null;
NormSession session = null;
String destAddress = DEST_ADDRESS;
int destPort = DEST_PORT;
try {
int length = 0;
int offset = 0;
byte[] buf = new byte[65536];
boolean useUnicastNACKs = false;
instance = new NormInstance();
session = instance.createSession(destAddress, destPort,
NormNode.NORM_NODE_ANY);
session.setDefaultUnicastNack(useUnicastNACKs);
session.startReceiver(SESSION_BUFFER_SIZE);
boolean streamIsAlive = true;
NormEvent event;
Log.d("NormStreamRecv", "Starting receiver...");
while ((null != (event = instance.getNextEvent())) && streamIsAlive) {
NormEventType eventType = event.getType();
NormObject normObject = event.getObject();
switch (eventType) {
case NORM_RX_OBJECT_NEW:
Log.d("NormStreamRecv", "New stream!");
break;
case NORM_RX_OBJECT_UPDATED:
if (normObject instanceof NormStream) {
int numRead = 0;
NormStream normStreamobj;
normStreamobj = (NormStream)normObject;
while (0 < (numRead = normStreamobj.read(buf, 0, buf.length))) {
if (-1 != numRead) {
Log.d("NormStreamRecv", "Read: " + numRead);
}
}
} else {
Log.d("NormStreamRecv", "Unknown object type!");
}
break;
case NORM_RX_OBJECT_COMPLETED:
Log.d("NormStreamRecv", "Completed stream!");
streamIsAlive = false;
break;
}
}
}
catch (IOException ex) {
ex.printStackTrace();
}
catch (NumberFormatException ex) {
Log.d("NormStreamRecv", "NumberFormatException: " + DEST_ADDRESS + ":"+ DEST_PORT + " " + ex.getMessage());
}
if (null != session) {
session.stopReceiver();
session.destroySession();
}
if (null != instance) {
instance.destroyInstance();
}
}
}
The text was updated successfully, but these errors were encountered:
chenqinggang001
changed the title
No data can be received after a period of continuous operation
After running for a period of time, the receiver cannot receive data
Nov 22, 2024
I tried to use norm to send data stream under android, it works fine, but whenever it runs continuously for a period of time, it cannot receive data, abnormal content:
NormStreamObject::WriteSegment() broken stream data not read by app!
my code:
The text was updated successfully, but these errors were encountered: