Send Bytes over TCP/IP

{noformat}I am trying to send an array of bytes over tcp using OutputStream to a chat dispatch server, but few extra bytes are getting added at the begining and
at the end of the original data I want to send.
Why is this hapening and how do I overcome this?{noformat}

ejp wrote:
byte[] consisted of byte array converted from this hex dumpConverted how?
If you use a String as a container for this binary data it will be corrupted.I declared the dump as a string like:
"8A00000000000000000000000B000000476174656B6565706572320F0000004765744C6F67696E536572766572735C0000001800000052656469666620426F6C382E3020206275696C6420323735030000000A00000052424F4C2F312E322E351700000052424F4C2F312E322E352B485454505F434F4E4E4543540F00000052424F4C2F312E322E352B48545450"
after this what should i do?
what I am doing is
1. extract two characters from the string at a time
2. join them to make a string of two characters
3. then treat that string as a hex value
4. convert that hex value to its ascii-char equivalent( so i get an array of characters )
5. convert the array of characters to array of bytes and send .
I think that there is a better way to do this. Please suggest. So that no problem occurs.

Similar Messages

  • Can I render a Flash frame as a bitmap and send it over TCP/IP?

    I want to draw some combination of bitmaps, flash shapes, vectors, text etc and draw them programmatically into my movie using ActionScript, and then get every "rendered" pixel of my movie (at 100% view) into an array that I send to another program over TCP/IP. Can anyone help me here?
    The first part of the question is if its possible to render a frame that is a collection of Flash elements as a bitmap? I know that I can iterate through a bitmap and get every pixel using the getPixel method but I'm trying to access the final rendered frame displayed on my screen, including, as I said Flash shapes and text.
    The second question is what would be the best way to send this "video frame" over TCP/IP? Would I use an XML socket connection? That is the only way I know how to send data out of Flash over TCP/IP but I don't know if it is the only way - the help page says the data needs to be formatted as XML, which seems unwieldly for this application.
    I'm doing this now by using Max/MSP/Jitter to do a screen capture the size and location of my Flash movie and then send out the resulting matrix using a "jit.net.send" object (which lets you send frames of video over TCP/IP), but this is too clumsy for the installation I am building.
    Any help would be greatly appreciated!
    -bob

    Thanks! That was exactly what I was looking for in the first half of the question. And I guess the draw() method works in AS2 as well as AS3. I will test it but from what I understand, I can use a Bitmap as kind of my bottom-level container, then create (in ActionScript) a movie clip that can contain other movie clips or drawing API commands or whatever, animate these various elements then finally draw() them into the bitmap. I see that in AS3 I can even use getPixels or getVector to capture the full "video frame" in one line of code.
    Thanks rothrock, for the helpful links. My application is kind of unusual, in that I'm sending "video" data to a proprietary LED controller box for display on a low resolution LED display. I connect to the box over TCP/IP and send it "frames of video" 20 times a second. I got this to work with this other content and software (Max/MSP/Jitter) and I want to see how I could capture all the rendered pixel data in successive frames of Flash animation, format it properly, then send it over TCP/IP to this controller box. Don't really now enough about the various flavors of TCP/IP connections to figure out how to do this in Flash, and I know there are security limitations built in to Flash that have to be worked around. But my movies are small (say 96 pixels by 72 pixels) and I need to send uncompressed data directly to my controller box, so these interesting links showing how to use server-side scripts to create jpgs or pngs are probably not going to help me. I will hopefully find a higher-level programmer than myself to work this out, and I think some of the techniques here will hopefull prove to be helpful.
    Thanks again for your help!

  • Help need for sending object over TCP Connection

    I have
    ResultSet rs = (ResultSet)connection.getObject(1)
    and i have user's connection connected on a port
    Currently i am reading while rs.next elements , preparing somestring and i am using socket_connection.send('to_myuser',somestring) to send message
    and user receive it like (while input_stream.readLine() != null )
    etc .etc.. i am just writing some algorithm which very common.
    i want to reduce this recursion on the my server end and once user receive it , and to get all result set retrieved from that end.
    my question is , is it possible to send
    connection.send('myuser',rs);
    and how to read on the other end.
    Thanks in advance

    Just want to clarify how we can cache it..? I belive
    we have to put data somewher in the ArrayList or
    something ....which one major taskOf course caching requires that you store it in something.
    >
    second, you need a very good algorighm to query all
    your collections ... i think oracle SQL mechanism is
    very nice.... however in your recommended approach i
    have to write lots of searching and sorting
    alrogrthm... .correct?Generally no. Requests are usually limited to very few parameters and often limited only to one or zero. Thus a user first gets a list of customer names (no parameters for query) and then request the detail about a specific customer (using the customer id which is only one parameter.)
    Note that you mentioned large amounts of data. You didn't specify what large meant. However large requests should never be allowed from users (people). They can't use it anyways. Automated processes should be architected to provide for a technological solution with is cost effective.

  • How do i send an array of clusters with variable size over TCP/IP?

    Hi,
            I'm trying to send an array of clusters with varible size over TCP/IP,. But I'm facing the following problems:
    1) I need to accept the size of array data from the user and increase the size dynamically.
    I'm doing this using the property node but how do I convey the new size to my TCP read?
    2) I need to wire an input to my 'bytes to read' of the TCP read.
    But the number of bytes to read changes dynamically
    How do I ensure  the correct number of bytes are read and reflected on the client side?
    3) Is there anyway I can use global varibles over a network such that their values are updated just as if they would on one computer?
     Will be a great help if someone posts a solution!
    Thank you...

    twilightfan wrote:
    Altenbach,
     ... xml string. ...number of columns that I'm varying using property node s... I solved these problems by using a local variable as the type input ...o TCP read is creating a problem.... second TCP read gets truncated data because
    its no longer just the first four bytes that specify the length of the data, it could be more as my array of cluster can be pretty huge.
    Instead of writing long and complicated sentences that make little sense, why don't you simply show us your code? 
    What does any of this have to do with xml strings???? I don't see how using a local variable as type input changes anything. The user cannot interact with "property nodes", just with controls. Please clarify. Once the array of clusters is flattened to a string you only have one size that describes the size of the data, no matter how huge it is (as long as it is within the limits of I32). Similarly, you read the string of that same defined length and form the array of clusters from it. How big are the strings? What is your definition of "huge"?
    Here's is my earlier code, but now dealing with an array of clusters. Not much of a change. Since you have columns, you want 2D. Add as many diensions you want, but make sure that the control, diagram constant, and indicator all match.
    The snipped shows for a 1D array, while the attached VI shows the same for a 2D array. Same difference.  
    Message Edited by altenbach on 01-31-2010 01:13 AM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    FlattenArrayOfClusters.vi ‏12 KB
    ioclusters3MOD.png ‏25 KB

  • I can't send anything over 1024 bytes by using visa via TCPIP

    I am trying to use NI-VISA talk to instruments visa TCPIP. The problem is I can not send anything over 1024 bytes using viPrintf or viBufWrite call. A time out will be returned. I tried to use MAX to open a VISA session for my TCPIP device. If I put a string less than 1024 bytes in write buffer, it is fine. Anything longer than that will cause time out and some time the whole MAX crash.

    Hi Johnma,
    I suggest you check the specs on TCP/IP. I seem to remember a limit on the packet size. TCP is just the transport layer. Higher layers should handle the work of breaking packets into smaller sizes and tracking packet sequencing.
    I am relying on memory hear so please verify. (maybe the limit was 4096 and I am full of it).
    I also believe there was some discusion of a related topic recently on info-labview where Rolf did a good job explaining what was happening.
    Search for "Rolf" and "TCP" on Brian Renkins search engine.
    http://infolv.brianrenken.com/
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • How to send joystick data over TCP connection

    Hi all,
    I am a long time Labview discussion forum user for learning, but this is my first time posting a question, I hope somebody can help me!
    In the attached VI I am trying to send data from a joystick over a TCP connection. I can send data fine using the TCP examples (in fact the majority of my VI is just a copy of the example). However I am to the point where I do not know how to send all the data necessary (3 axis data, 12 buttons, and the POV data) over TCP. Strings, clusters, and arrays were never my strong suite and converting between them is a nightmare for me.
    Basically I am trying to send each axis data (X,Y, and Z), button data (12 buttons), and POV data (the POV data will be calculated to adjust the position of a camera, so the immediate data is not important, I will add functions to add the change in the button movements to write a standing position for two servos [pan and tilt], for which that I will need to send over the TCP connection) over the TCP connection to control various cameras and motors. I don't know if it is posible to send that much data over a TCP connection in one write VI through a string, and also how to separate the string on the other side in order to control the client VI.
    Again, the actual TCP communication I get, and can operate fine, just formatting all the data into a string (or whatever is required) so that I can unpack on the other side is the issue here.
    Another question I have (not impotant to get the program running just might make it easier on me) is can a TCP server (which sends the data to the client) also recieve data back from the client on the same port ( for example sensor data and digital positions [on,off])? Or do I need to set up two TCP communication loops with the first client acting as the server on a different port than the first, which then sends the data to the original server, which also has a client TCP configuration in another loop? I hope this makes sense...
    One final question.....I already have a solution to this but using labview for the entirety of this project would be nice. I use skype to stream 1080p video from a webcam to my computer so I can view live feed. Can labview do this? This would be awesome if so, I am just not sure if the communication protocols in use could support real time (or as close as possible to streaming) for 1080p video.
    Thanks all in advance for your help,
    Physicsnole
    Attachments:
    cameraserver.vi ‏24 KB
    cameraclient.vi ‏18 KB

    Physicsnole wrote:
    In the attached VI I am trying to send data from a joystick over a TCP connection. I can send data fine using the TCP examples (in fact the majority of my VI is just a copy of the example). However I am to the point where I do not know how to send all the data necessary (3 axis data, 12 buttons, and the POV data) over TCP. Strings, clusters, and arrays were never my strong suite and converting between them is a nightmare for me.
    Well, you cast the axis info cluster to a string, but then you cast it back to an array of DBL. Thatr's not compatible. You should probably cast it back to an "axis info" cluster of exactly the same type. Go the the other VI and right-click the cluster wire to create a constant. Now move that diagram cluster constant to the other VI and use it as type.
    Your default ports don't seem to match. You seem to have client and server roles confused. In the sever you create a listener, but then you start sending packets, even though no connection is established. The connection needs to be initiated by the client.
    Your client stops the loop the first time a timeout is encountered. Shouldn't that be more permanent? Also, please retain code clarity and avoid unecessary complexities. For example, replace the "not or" with a plain "or" and change the loop to "stop if true"
    Physicsnole wrote:
    Basically I am trying to send each axis data (X,Y, and Z), button data (12 buttons), and POV data (the POV data will be calculated to adjust the position of a camera, so the immediate data is not important, I will add functions to add the change in the button movements to write a standing position for two servos [pan and tilt], for which that I will need to send over the TCP connection) over the TCP connection to control various cameras and motors. I don't know if it is posible to send that much data over a TCP connection in one write VI through a string, and also how to separate the string on the other side in order to control the client VI.
    You can send as much as you want. The casting to/from string is the same as described above.
    Physicsnole wrote:
    Another question I have (not impotant to get the program running just might make it easier on me) is can a TCP server (which sends the data to the client) also recieve data back from the client on the same port ( for example sensor data and digital positions [on,off])? Or do I need to set up two TCP communication loops with the first client acting as the server on a different port than the first, which then sends the data to the original server, which also has a client TCP configuration in another loop? I hope this makes sense..
    The primary function of a "server" is to wait for a connection and then communicate with the client once a conenction is established. An established TCP/IP connection is fully two-way and both sides can send and receive.
    LabVIEW Champion . Do more with less code and in less time .

  • Capturing Camera & Sending over TCP

    Hi friends,I work on network based project ,I am traing to capture webcam (audio + video) and send over network
    These code is working starts the webcam saves video and audio during given time(3000 (3 seconds) saves into file then stops the webcam.
    //formats[0] = new AudioFormat( AudioFormat.GSM);
    //formats[1] = new VideoFormat(VideoFormat.CINEPAK);
    //formats[1] = new VideoFormat(VideoFormat.H263);
    //FileTypeDescriptor outputType = new
    //FileTypeDescriptor( FileTypeDescriptor.QUICKTIME );
    formats[0] = new AudioFormat( AudioFormat.LINEAR);
    formats[1] = new VideoFormat(VideoFormat.RGB);
    FileTypeDescriptor outputType = new
    FileTypeDescriptor ( FileTypeDescriptor.MSVIDEO );
    try {
    p = Manager.createRealizedProcessor(
    new ProcessorModel( formats, outputType) );
    } catch( NoProcessorException e ) { System.out.println(e );
    } catch( CannotRealizeException e ) { System.out.println(e );
    } catch( IOException e ) { System.out.println (e );
    TrackControl track[] = p.getTrackControls();
    System.out.println("No. of tracks="+track.length);
    for (int i = 0; i < track.length; i++) {
    System.out.print("Track #"+i+": " +track.getFormat() + " \n" );
    } DataSource source = p.getDataOutput();
    String filename = "movies.mpg" ; // movie.avi
    String locator = "file://" + System.getProperty( "user.dir")
    System.getProperty( "file.separator") filename ;
    MediaLocator dest = new MediaLocator(locator);
    try{
    fileWriter = Manager.createDataSink( source, dest );
    } catch( NoDataSinkException e ) {
    System.out.println("The DataSink Exception tgv :" + e);
    } catch( SecurityException e ) { System.out.println(e); }
    fileWriter.addDataSinkListener( new DataSinkListener() {
    public void dataSinkUpdate( DataSinkEvent event) {
    if ( event instanceof EndOfStreamEvent ) {
    fileWriter.close();
    StreamWriterControl swc = ( StreamWriterControl)p.getControl(
    "javax.media.control.StreamWriterControl");
    if( swc != null) {
    swc.setStreamSizeLimit(1024 * 1024 );
    try{
    fileWriter.open();
    fileWriter.start();
    source.connect();
    source.start();
    p.start();
    } catch( IOException e ) { System.out.println(e);
    System.out.println( "File storage starts now \n ");
    try{
    Thread.sleep(3000);
    } catch( Exception e ) { System.out.println( "Error:" + e ); }
    System.out.println( "File storage stops now \n ");
    try{
    p.stop();
    p.close();
    fileWriter.close();
    source.disconnect();
    source.stop();
    } catch( IOException ioe ) { System.out.println( ioe ); }
    I works it is fine but I need to send it over network
    So what I need? I need to capture until I prefer to close webcam.
    I need to save the captured video and audio to the file every 1000 seconds then send it over network
    So I tried the code with timer and I add some code to send file over network.//formats[0] = new AudioFormat( AudioFormat.GSM);
    //formats[1] = new VideoFormat(VideoFormat.CINEPAK);
    //formats[1] = new VideoFormat(VideoFormat.H263);
    //FileTypeDescriptor outputType = new
    //FileTypeDescriptor( FileTypeDescriptor.QUICKTIME );
    formats[0] = new AudioFormat( AudioFormat.LINEAR);
    formats[1] = new VideoFormat(VideoFormat.RGB);
    FileTypeDescriptor outputType = new
    FileTypeDescriptor ( FileTypeDescriptor.MSVIDEO );
    try {
    p = Manager.createRealizedProcessor(
    new ProcessorModel( formats, outputType) );
    } catch( NoProcessorException e ) { System.out.println(e );
    } catch( CannotRealizeException e ) { System.out.println(e );
    } catch( IOException e ) { System.out.println (e );
    TrackControl track[] = p.getTrackControls();
    System.out.println("No. of tracks="+track.length);
    for (int i = 0; i < track.length; i++) {
    System.out.print("Track #"+i+": " +track[i].getFormat() + " \n" );
    } final DataSource source = p.getDataOutput();
    try {
    String filename = "movies.mpg"; // movie.avi
    String locator = "file://" + System.getProperty("user.dir") + System.getProperty("file.separator") + filename;
    MediaLocator dest = new MediaLocator(locator);
    try {
    fileWriter = Manager.createDataSink(source, dest);
    } catch (NoDataSinkException e) {
    System.out.println("The DataSink Exception tgv :" + e);
    } catch (SecurityException e) {
    System.out.println(e);
    fileWriter.addDataSinkListener(new DataSinkListener() {
    public void dataSinkUpdate(DataSinkEvent event) {
    if (event instanceof EndOfStreamEvent) {
    fileWriter.close();
    StreamWriterControl swc = ( StreamWriterControl)p.getControl(
    "javax.media.control.StreamWriterControl");
    if( swc != null) {
    swc.setStreamSizeLimit(1024 * 1024 );
    int delay = 2000; // delay for 2 sec.
    int period = 3000; // repeat every sec.
    Timer timer = new Timer();
    timer.scheduleAtFixedRate(new TimerTask() {
    public void run() {
    try {
    fileWriter.open();
    fileWriter.start();
    source.connect();
    source.start();
    p.start();
    } catch (IOException e) {
    System.out.println(e);
    System.out.println("File storage starts now \n ");
    try {
    Thread.sleep(3000);
    } catch (Exception e) {
    System.out.println("Error:" + e);
    System.out.println("File storage stops now \n ");
    p.stop();
    p.close();
    fileWriter.close();
    source.disconnect();
    source.stop();
    System.out.println("File is Sending now \n ");
    fis = new FileInputStream("C://movies.mpg");
    buffers = new byte[fis.available()];
    fis.read(buffers);
    oos.writeObject(buffers);
    oos.flush();
    fis.close();
    System.out.println("has been sent \n ");
    } catch (IOException ex) {
    Logger.getLogger(frm.class.getName()).log(Level.SEVERE, null, ex);
    }, delay, period);
    it works opens webcam start capture save into file ,sends over network then camera closes..
    my problem is camera should still opened.
    and as a lastformats[0] = new AudioFormat( AudioFormat.LINEAR);
    formats[1] = new VideoFormat(VideoFormat.RGB);
    FileTypeDescriptor outputType = new
    FileTypeDescriptor ( FileTypeDescriptor.MSVIDEO );
    try {
    p = Manager.createRealizedProcessor(
    new ProcessorModel( formats, outputType) );
    } catch( NoProcessorException e ) { System.out.println(e );
    } catch( CannotRealizeException e ) { System.out.println(e );
    } catch( IOException e ) { System.out.println (e );
    TrackControl track[] = p.getTrackControls();
    System.out.println("No. of tracks="+track.length);
    for (int i = 0; i < track.length; i++) {
    System.out.print("Track #"+i+": " +track[i].getFormat() + " \n" );
    } final DataSource source = p.getDataOutput();
    int delay = 2000; // delay for 2 sec.
    int period = 3000; // repeat every sec.
    Timer timer = new Timer();
    timer.scheduleAtFixedRate(new TimerTask() {
    public void run() {
    try {
    String filename = "movies.mpg"; // movie.avi
    String locator = "file://" + System.getProperty("user.dir") + System.getProperty("file.separator") + filename;
    MediaLocator dest = new MediaLocator(locator);
    try {
    fileWriter = Manager.createDataSink(source, dest);
    } catch (NoDataSinkException e) {
    System.out.println("The DataSink Exception tgv :" + e);
    } catch (SecurityException e) {
    System.out.println(e);
    fileWriter.addDataSinkListener(new DataSinkListener() {
    public void dataSinkUpdate(DataSinkEvent event) {
    if (event instanceof EndOfStreamEvent) {
    fileWriter.close();
    StreamWriterControl swc = ( StreamWriterControl)p.getControl(
    "javax.media.control.StreamWriterControl");
    if( swc != null) {
    swc.setStreamSizeLimit(1024 * 1024 );
    try {
    fileWriter.open();
    fileWriter.start();
    source.connect();
    source.start();
    p.start();
    } catch (IOException e) {
    System.out.println(e);
    System.out.println("File storage starts now \n ");
    try {
    Thread.sleep(3000);
    } catch (Exception e) {
    System.out.println("Error:" + e);
    System.out.println("File storage stops now \n ");
    p.stop();
    // p.close();
    fileWriter.close();
    //source.disconnect();
    source.stop();
    fis = new FileInputStream("C://movies.mpg");
    buffers = new byte[fis.available()];
    fis.read(buffers);
    oos.writeObject(buffers);
    oos.flush();
    fis.close();
    } catch (IOException ex) {
    Logger.getLogger(frm.class.getName()).log(Level.SEVERE, null, ex);
    }, delay, period);
    this code works open the webcam capture save and send over network contineusly with out giving any error
    It creates video in my local pc and send over network I  can see that video size is changing every seconds
    And fourtunately I am caming to my problem If I close processor "p.close()" program create video file but it can npt be rendered by any player
    it is some thing but I am sure that it is not a video
    If I close processor "p" camera still opened but video is not valid
    I know that I wrote lots of things but I could not figured out the problem and solution
    Thanks...                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    You won't get any help because you've overloaded us with probably-irrelevant information and done nothing at all about trying to whittle the problem down to its roots. Plus, your subject line suggests that you're asking someone to write a fairly sizable bit of your app for you, and hence will get ignored by a lot of people
    Try and work out exactly what isn't working, and ask about it. As it is, you've written a load of code, it doesn't work, and you've just dumped it here expecting someone else to pick through it all and fix it - not going to happen
    And please, before you reply with some cutting comment about how unhelpful I am, consider that you'd been given no replies whatsoever so far

  • Lange files over TCP

    Hello!
    I am trying to send a lange file (.avi) over tcp. What I am currently doing is using a Fileinputstream to read the entire file at once in order to send it. The problem, as someone would expect, is an outofmemory exception. Is there a better way to send this packet over TCP? I thought of splitting the file into segments but I don't know how I can ensure that the receiver will get all the segments in the right order.
    Thanks
    Paul

    If memory is not an issue, simply allow your application launcher to allocate more memory (current default is 64MB max):
    java -Xmx128m myClass
    ...this will allow myClass to allocate up to 128MB during runtime. This will solve your problem but it is not the best way to
    You should follow your intuition about splitting the file into packets. Put a byte or two at the beginning of the packet as an "ID tag" to tell your client (receiver) which packet it is receiving. Your client can buffer the packets (in a Vector, or something similar) and then use the ID tag to figure out how to reassemble them. Make sure you strip out the ID tag before reassembly!
    Another advantage to splitting the file and using packet ID's is that of reliable transmission. Should your client receive a bad packet (are you using a checksum?) or drop its connection before the transmission is complete, it can simply request that the server re-send the appropriate packet by referencing its ID.

  • Why is Diadem DAC is slow when reading over TCP/IP?

    Hi,
    I wrote a small VB Script in order to comunicate with a Power Supply over TCP/IP in Diadem DAC, when I first run it, it works perfectly but if I I stop the program and run it again it is suddenly very slow. The only way to make it run normaly again is If I restart Diadem.
    Am I closing my TCP/IP connection correctly? I am not sure what the problem could be.
    thanks for your help
    Attachments:
    PSC_ETH_ReadWrite_Script.txt ‏2 KB

    Hi,
    sorry, but I've no answer to this question but nearly the same problem.
    I wrote a small Qt socket app. which provides a TCP-Server sending every 100 ms.
    I'd like to have Diadem plotting the sent data - I setup a 25 ms refresh rate but
    the actual refresh lasts for about 1 s!! The sent values seem to reach Diadem
    but the processing needs very much time, hence the processor load goes
    directly to 100% which seems to be very strange. I put my code for reading
    the values into the TCP script driver template - SFD_ReadChannel method.
    If comment out the "oUDIM.read()" the refresh is as expected, with the read
    command everything slows down dramatically?
    What's the mistake?
    Best regards and thanks for your help...

  • Connecting to labview over TCP/IP port

    I have got an undocumented project to maintain, it has a Java UI code, which connects with some component of LABVIEW over
    TCP/IP Port = 1234
    and over this port it sends commands for clear, get, set
    I need links for understanding the component from LABVIEW which is been accessed over port 1234
    I have installed LABVIEW Run time 2013, and do not know which PROCESS the Java code is trying to connect over TCP/IP, and I do not see any of the RT processes binding to port 1234.
    Any pointers/links would certainly help me!
    Thanks,
    -Vikrant

    Can you define what you mean by "component of LabVIEW"?
    The LabVIEW runtime engine is just a required component to run any custom build LabVIEW executable or dll. So, what is it?
    You also mention RT processes. Does this run on an RT system? What is running where? If you are connecting to a remove LabVIEW RT system that runs a service on port 1234, you don't need LabVIEW or a run time engine at all on the local side.
    At this time we don't have any useful information from you. Please be significantly more detailed! Thanks.
    LabVIEW Champion . Do more with less code and in less time .

  • Need help with Modbus RTU over TCP communication

    Hello!
    I'm working with a project that involves communication between a LabView PC, a cRIO-9073 and a few Crouzet PLC's with XN05 modbus extentions. The issue I'm having is to get a stable and reliable connection between the units. The cRIO is communicating with the PLC's by Modbus RTU over TCP and I've created code that read and write to them in a sequential order to avoid possible ModBus conflicts. The LabView PC is sending a "ping" (boolean true) every second to the cRIO over UDP and the cRIO is then sending the "ping" to the PLC over Modbus/TCP. The PLC has a timer that waits for pings, if no ping has been recieved in 7 seconds the emergency brakes are applied and the system shuts down.
    The main problems right now is:
    * After a while I lose the connection between the LabView PC and the cRIO. "Connection with RealTime target cRIO-9073 has been lost".
     - I also get either error code 56 or 66 on the TCP link.
    * The second problem is that if I quickly pull a TP-cable from, let's say, a PLC and then directly plug it back in I want the TCP connection to quickly reestablish. However what happens is that the "pings" from the cRIO stops coming to the PLC for like 5-6 seconds (time to reestablish link?), which means the 7 second timer is almost full. One option would be to raise that timer value, but the drawback is that the system will take longer time to respond to an true error which could be bad.. My question is simply, does it really take 5-6 seconds to establish a TCP connection between a cRIO and a PLC? What affects the time? 
    I would greatly appreciate help or respons on this one. I attach a simplified version of the code I use (all variables and such has been replaced with constants). 
    Is this a good way to do a ModBus communication over TCP with 3 PLC's?  Is there a better, safer, more reliable way? All suggestions on improvment is appreciated
    Thanks!
    /J
    Attachments:
    MB_TCP.vi ‏29 KB
    MB_PLC.vi ‏28 KB

    Dear J,
    Check the state machine Architecture here.
    1. In your acquisition if you got error in any system you close all TCP connections that is not right your other systems are working fine.
    2. You go with parallel loop connection. For each PLC you run separate code with error handlers.
    3. Check the attached VI for TCP Read. Same VI you can modify and use for your ModBUS operations.
    4. In you Sub VI you are passing a constant cluster. I am not able to understand what is the use of case structure inside the subVI, In you code you are passing the constant so its always same.
    As you done previously made 3 loops or VIs to read the data in a main VI. First try to made one VI with one PLC, remove your all bugs and errors and copy it 3-time with different-different configurations.
    Thanks and Regards
    Himanshu Goyal | LabVIEW Engineer- Power System Automation
    Values that steer us ahead: Passion | Innovation | Ambition | Diligence | Teamwork
    It Only gets BETTER!!!
    Attachments:
    Tcp Host.vi ‏28 KB

  • Sending Video over the wireless network

    I am considering capturing images from a IEEE 1394 camera and sending it over the Wireless network to another computer.  The reason we want to do that is to make the
    camera device light and portable by connecting it to a portable tablet computer.
    What kind of protocol is the best way to transfer the image. The TCP or UDP in labview convert data into string before the transmission which are very inefficient. I just want to streaming the raw image data, maybe with some protocol overhead.  Did National Instrument has any package to do that or any other software packages available?
    There might be another solution is to use the Ethernet cameras instead of 1394 cameras.
    Would it be possible for the Labview application on a remote desktop computer to acquire the Ethernet camera over a WiFi wireless connnetction in between ?
    Thanks
    Cindy

    Hello Cindy,
    If you want to transfer data across a
    network, TCP would be the most efficient method (wireless is typically not as
    successful as Ethernet due to the overhead).  There is actually a very useful knowledgebase
    document that discusses the various methods used to transfer image data across
    a network.  If you go to our main site http://www.ni.com and search using the keywords “Images
    Over Network”, the first link is entitled Streaming
    IMAQ Images Over a Network (or Internet) which gives brief descriptions if
    you choose to use TCP/IP, Datasocket, LabVIEW web server, or ActiveX.  Another very informative document results in
    that same search and is titled Transfer Images Over the Network
    which actually gives examples
    illustrating different ways to send images.  I hope this helps.  Please let us know if you would like further
    clarification or assistance regarding this issue.Vu D

  • Sending byte array to server

    Does anyone know how to send a byte array to the server?

    What is contained in the byte array? Is it audio/video/image?
    If you can get a binary representation of it, you could probably
    convert it to Base64 and send it over as a string and reconvert to
    binary on the server.

  • Sending voice over UDP with JavaSound

    Hello,
    do anybody know how to send voice over UDP?. I have .wav files and I want to send them over UDP. If you have an example of this, send me it please. All the examples that I have seen only send one or to lines of text, but I need to know if I should convert the frames to bytes to be sent.
    Thank your help

    Hello,
    do anybody know how to send voice over UDP?. I have .wav files and I want to send them over UDP. If you have an example of this, send me it please. All the examples that I have seen only send one or to lines of text, but I need to know if I should convert the frames to bytes to be sent.
    Thank your help

  • APDU over TCP (jcwde)

    Dear All:
    The jcwde tool binds to port 9025/tcp, I have understood that the apdutool can be scripted for testing the applet, however, since this is tcp, I would like the power to design my own client in order to produce more human readable output.
    How is the APDU commands/responses formated in the tcp packets?
    Ofcourse, I might also try to create a wrapper around apdutool. The things I'd like to do is like: Sign string "bla bla" rather than send apdu "0xBC 0xC0 ..." .
    Thanks, Erik

    Hi,
    IPSEC over TCP is not supported in 6.3. It is only supported in 7.x versions.
    HTH,
    Please rate if it helps,
    Regards,
    Kamal

Maybe you are looking for

  • Volume Too Low on Some Headpho

    I know the volume issue has been beaten to death. I bought my Zen Touch player in Canada, not in Europe. I have noticed that with the earbuds that came with the player, and with a pair of Panasonic headphones that came with a CD player I bought, the

  • Images of ipad for printing

    Hi, dont know if this is the right forum but i am looking for images of the ipad to put on to our works web site. Does anybody know where i could download some that are Royality free or safe to use on a commercial website? It is to show the ipad as a

  • "Manage Users" IR report displaying incorrect user types

    Home>Administration>Users APEX 4.0.2.00.07 DB 11.2.0.2 Found a couple of question-raising things: 1) User type is showing "Workspace Administrator" for almost all users (many are only users) with a couple identified as "Developer" (who really do only

  • Deploy and Bind ant tasks

    Re, I am using the 10.1.3 beta of oc4j and we are starting to run into some problems with using the oracle deploy and bind ant tasks provided. As our application is growing, the deploy task is taking longer and longer (which by itself is not really a

  • Needing recompilation.....!!!!

    Hi, I have noticed that some not all forms (*.fmb) needs manual recompilation (f60gen ....) when they are copied to the client's env. Otherwise the simple copy of .fmx to the proper directory ($CUSTOM_APP/11.5.0/forms/US) generate ORACLE error "ORA-0