Audio over TCP Socket

Hi,
I need a sample code for transmit/receive a audio over TCP socket.. can anybody help me?

You send and receive it in the same way as you handle any binary data.
Kaj

Similar Messages

  • Streaming video over TCP (sockets)

    We are trying to stream only video files between a client and a server, but we don't know how. We are using sockets TCP to connect both systems and we would like to know if exists any class in Java that could be helpful for us, or if any of you has created a source code that could help us and give us ideas about how to continue.
    Thanks in advance

    If you want exact representations of the video files, that is, bit for bit equality from end to end, tcp is fine. But you say streaming, so you will want to have a look at the UDP. This transfer doesn't care if some bits are lost along the way.
    If you want tcp, you should use RMI to transfer your files.

  • TCP sockets on MIDP over GPRS

    Extending the CLDC socket.Protocol class I can make a TCP socket connection from a MIDlet. I'm hoping to market my application on GPRS networks, but I'm not sure that it supports TCP connections. I've read that TCP runs on circuit switching networks, and UDP on packet switching networks. I think GPRS is the latter. I need to maintain a constant, "connection-oriented" socket - i.e. TCP. Does anyone happen to know whether TCP/IP will function properly over GPRS? I realise this is why MIDP only implements HTTP and not raw sockets, but I thought it was worth asking anyway. Any help at all would be greatly appreciated.

    Hi Briggsd!
    I'm playing with some sockets.
    can you please help me?!
    J2ME uses only HTTP connections?
    and what are the sockets? what is the difference between CLDC socket and J2SE Socket?
    is there any other way to communicate with a Servlet?
    and very important..
    is there a difference if it's using GPRS or 3G?
    would the http connection work for all? and just the connection speed would change?
    help me!!

  • 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!

  • C++ can send a "struct" over TCP.How to do the same fuction with JAVA?

    as Title~
    C++ send a struct like the following...
    NEO_MSG neo_msg;
    struct NEO_MSG
    int iPortRecv; // port for recv data of client
    char verify;
    ////After create a TCP connection....
    send(ServerSock, (char*)&neo_msg, sizeof(neo_msg), 0);
    How to rewrite it with JAVA?

    If you are trying to do it in a way that is compatible with C++, then you'll need to write the bytes to the socket. You can do this by wrapping the socket's output stream with a DataOutputStream, then writing each value in order.
    Remember that a C++ struct is just a convention of accessing a linear array of bytes, so the above is equivalent.
    If you are just trying to send an Object's data over a socket (to another Java app), then you can wrap the socket's output stream with an ObjectOutputStream, then just write the object to it.
    - K

  • SOAP over TCP/IP

    Hi,
    Has anyone implemented SOAP over TCP/IP sockets instead of using a web server? Does JWSDP support this?
    Any information and pointers on how to implement this is highly appreciated.
    Thanks in advance.
    Amogh

    WSIT, which is built on top of JAX-WS supports SOAP/TCP. You can get wsit from http://wsit.dev.java.net

  • 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...

  • Modbus RTU over TCP (Simex Transmitte​r and Advantech Server)

    Hey Guys,
    somehow i am not able to get a connection over TCP IP using RTU Mode (reading values) from a  transmitter which is hooked up to an advantech EKI 1542 Server. The Port is configured as an RS 485.
    i am using the modbus library and i tried to adjust the MB serial read holding registers vi to accept a TCP IP Socket input instead of an INSTR. Do you have any suggestions?
    Thanks a lot for the forum support!

    Hi Christo and welcome to NI Forums!
    Is this the ModBus library you are using? If so, I'd recomend to check out the newer, object based library available here. It has a more straightforward setup, especially for using TCP connections. You'll find an example VI for using a master, as well as a slave device, and these you'll be able to use right away without much modification. The code'll look like:
    Please test your device communication using this library.
    Kind regards:
    Andrew Valko
    NI Hungary
    Andrew Valko
    National Instruments Hungary

  • Detect "end of file" while send n numbers files over a socket?

    Hi!
    I�m trying to find a way to detect "end of file" while send n numbers files over a socket.
    What i'm looking for is how to detect on the client side when the file i�m sending is downloaded.
    Here is the example i�m working on.
    Client side.
    import java.io.*;
    import java.net.*;
    public class fileTransfer {
        private InputStream fromServer;
        public fileTransfer(String fileName) throws FileNotFoundException, IOException {
            Socket socket = new Socket("localhost", 2006);
            fromServer = socket.getInputStream();
            for(int i=0; i<10; i++)
                receive(new File(i+fileName));
        private void receive(File uploadedFile) throws FileNotFoundException, IOException {
            uploadedFile.createNewFile();
            FileOutputStream toFile = new FileOutputStream(uploadedFile);
            byte[] buffer = new byte[4096];
            int bytesRead = 0;
            while ((bytesRead = fromServer.read(buffer)) != -1) {
                toFile.write(buffer, 0, bytesRead);
        public static void main(String[] args) {
            try {
                new fileTransfer("testa.jpg");
            } catch (Exception ex) {ex.printStackTrace();}
    }Server side.
    import java.io.*;
    import java.net.*;
    public class fileTransferSend {
        Socket serv = null;
        OutputStream toClient;
        public fileTransferSend(String fileName) throws FileNotFoundException, IOException {
            StartServer();       
            for(int i =0; i<10; i++)
                send(new File(fileName));
        public void StartServer() throws IOException {
            ServerSocket ssocket = new ServerSocket(2006);
            System.out.println("Waiting for incomming");
            serv = ssocket.accept();
            System.out.println("incomming");
            toClient = serv.getOutputStream();
        private void send(File f) throws FileNotFoundException, IOException {
            if(f.exists() && f.canRead()) {
                FileInputStream fromFile = new FileInputStream(f);
                try {
                    byte[] buffer = new byte[4096]; // 4K
                    int bytesRead = 0;
                    System.out.println("sending: "+f.getName());
                    while ((bytesRead = fromFile.read(buffer)) != -1) {
                        toClient.flush();
                        toClient.write(buffer, 0, bytesRead);
                finally {
                    //toClient.close();
                    fromFile.close();
            } else {
                System.out.println("no files");
        public static void main(String[] args) {
            try {
                new fileTransferSend("test.jpg");
            }catch(Exception e) {e.printStackTrace();}
    I know that the client never reads -1 becuase i doesn�t close the stream.
    Is there anyway to tell the client that the file is downloaded?

    A common (and easy) TCP/IP protocol is to send length, followed by data.
    Because TCP/IP is a stream-oriented protocol, a receiver can never absolutely determine where the first packet ends and the second packet begins. So it is common to send the length of the packet, followed by the packet itself.
    In your case, you could send length of file, followed by file data. It should be fairly easy to obtain file length and send that as a 32-bit (or 64-bit value). Here is an idea (not code) for the receiver:
    receive (4) // where 4 = number bytes to receive
    unsigned length = convert 4 bytes to unsigned integer
    while (length != 0)
    n = receive ( length ) // where n = number bytes actually received, and length = number bytes desired
    Or, you can use the concept of an "Escape" character in the stream. Arbitrarily choose an ESCAPE character of 0x1B (although it could be any 8-bit value). When the receiver detects an ESCAPE char, the next character can be either control or data. So for end of file you might send 0x1B 0x00. If the byte to be sent is 0x1B, then send 0x1B 0x1B. The receiver would look something like this:
    b = read one byte from stream
    if (b == 0x1B)
    b = read one byte from stream
    if (b == 0x00) then end of file
    else place b in buffer
    else
    place b in buffer
    Later.

  • Communication with database using TCP sockets connection

    Hi all,
    I am bit of a newbie when it comes to databases. In a project I realised over te passed few weeks, I communicated with an 11g database using an application I created with VS Express. It uses an ODBC connection. I now want to connect a PLC to the same database. These PLC's don't have the ability to install an ODBC client so I need something different.
    I am easily able to open a TCP socket on the PLC and send data from there. I would like to know if I can start a TCP sockets connection with our 11g server and send all queries directly. The other (already suggested) option would be to have the PLC connect to a PC that reads this information and hands it over to the ODBC connector, but that would mean I need an extra PC just to 'translate'.
    I have been searching these forums for socket, TCP and more and feel it is possible, but I need a good document as a reference to show/tell me how it's done.
    Thanks in advance,
    Marijn

    The TCP/IP interface to Oracle is undocumented (and hugely complex anyway). You'll need to use a higher layer iterface or setup your own infrastructure.
    We need more information about what is available to you inside the PLC.
    Can you use Java? If so, perhaps use thin JDBC?
    Can you sent HTTP requests? If so you could set up your own Web services to handle this.
    If you can only use C or C++, Oracle has interfaces there too.. it's called OCI (Oracle Call Interface) and thats as close to the networking layer as you can get.
    Finally if you can use .NET Oracle has a Fully Managed Oracle Data Provider for .NET that you could use.
    But if all you can do is super low level network access and none of the above then you will need to set up an intermediary as you mentioned.

  • Detect packet received using TCP sockets

    Hello:
    I was wondering if there was a way to detect if a packet has been sent to my socket. I know this sounds strange but here is what i want to do...
    I would like to do some processing on a render(distributed raytracing) while also waiting for a packet to be received over tcp ip. If i use .getInputStream() it just sits there at that line of code waiting for a packet. I would like to do some rendering and every now and then check to see if a packet has been sent. Is this possible? Or should i do this a totally different way? Thanks for your help!
    [email protected]

    Threads.
    One thread renders, the other threads blocks on the socket waiting for new information.

  • Multi Thread Server over TCP/IP

    Multi Thread Server over TCP/IP. Does it work?
    In my box it works only over IPC protocol.
    null

    S C Maturi (guest) wrote:
    : Mark Malakanov (guest) wrote:
    : : Multi Thread Server over TCP/IP. Does it work?
    : : In my box it works only over IPC protocol.
    : Mark,
    : Multi threaded server over TCP/IP will not work with
    : the current distribution of Oracle 8.0.5 on Linux.
    : This is corrected and a patch would be released soon.
    : Maturi
    tcp 0 0 bock.nettek-ll:listener bock.nettek-
    llc.co:4196 ESTABLISHED
    tcp 0 0 bock.nettek-llc.co:4196 bock.nettek-
    ll:listener ESTABLISHED
    (I have serveral of these)
    TNS Ping Utility for Linux: Version 8.0.5.0.0 - Production on 07-
    JAN-99 18:45:52
    (c) Copyright 1997 Oracle Corporation. All rights reserved.
    Attempting to contact (ADDRESS=(PROTOCOL=TCP)(HOST=localhost)
    (PORT=1521))
    OK (440 msec)
    ...and from my install log you see that I selected MTS:
    -[ YESNO
    Q> Would you like MTS (Multi-Threaded Server) configured
    and the SQL*Net$
    A> TRUE
    Please explain? Will TCP/IP MTS work via the loopback adapter
    only? So far I have not tried a remote TCP/IP connection.
    -STEVEl
    null

  • 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 .

  • Audio over standard DVI HDMI?

    What are the audio capabilities with the 1st 4 generations of MacBook Pros with standard full size DVI outputs when using a DVI to HDMI adapter?
    I know that the mini display and thunderbolt ports support full quality 7.1 audio at 24bit 96KHz over HDMI (plug and play right out of the box to a surround receiver). What about the DVI machines? Can you at least get stereo audio thru the DVI port for basic TV/movie watching? Or is audio over HDMI only available starting on the 5th generation MacBook Pros?

    Ehych is very correct.
    On your $300 switch box, here is *one from MonoPrice* that is only $43!
    I've purchased several cables & switch boxes from them - VERY good quality, price & shipping.
    Steve

  • Safety of MS Sharing on LAN over TCP/IP via NetBIOS and/or Direct SMB

    Shalini Sampath Kumar at http://answers.microsoft.com/en-us/windows/forum/windows_7-security/ suggested I post this question over
    here:
    What is the safest recommended way to set up MS File and Printer Sharing on a LAN with both Windows 7 Pro and XP Pro machines?  Does "Direct hosting of SMB over TCP/IP," help?  What about setting a "Scope ID" (or did that go out
    with Windows NT)?
    Background:  I've been trained to be paranoid about NetBIOS over TCP/IP.  Right now I have only XP Pro machines on my peer-to-peer workgroup LAN (behind a NAT router and with Simple File Sharing turned off), on which File and Printer Sharing has been
    unbound from TCP/IP and bound to NetBEUI instead, so I feel fairly safe.  Port scanning by ShieldsUp doesn't see any ports through the router, open or closed -- in other words, it appears to be "stealthed," for what that's worth.  With
    NetBIOS disabled on all computers inside the LAN, however, can I perform a valid test of what will happen when File and Printer Sharing is re-bound to TCP/IP?
    My New Problem:  I'm planning to add Window 7 Pro machines, for which NetBEUI isn't an option, and then to transition entirely to Win7 before XP goes off extended support in April.  I will still use a peer-to-peer architecture with password-protected
    sharing turned on (no HomeGroup).  It appears that I can still get rid of NetBIOS (and WINS) in favor of "Direct hosting of SMB over TCP/IP," which sounds safer.  Apparently then only port 445 will be vulnerable instead of ports 137-139. 
    In any case I want to do everything I can to protect my file-sharing port(s) from the Internet (e.g., from anyone who might break into my LAN either by making a wireless connection or by hacking the router itself).  Can anybody give a clear set of steps
    to change sharing from NetBIOS (which I would like to disable entirely) to direct hosting of SMB and to verify that I'm protected as well as possible?
    I will have to completely revamp the network-file-sharing configuration of my XP machines as soon as the first Win7 machine goes on line (and possibly tweak the configuration of Win7 as well), perhaps as early as this week. I want to do this in the way that
    maximizes security to the extent possible.  Thanks in advance more details and guidance on this topic! -- JCW2
    P.S. -- These computers are all laptops and will be used away from my home LAN -- another reason for paranoia about File and Printer Sharing.  I realize that Windows 7 provides an easy way to disable F&PS by selecting any new network location as
    "public," but XP does not (as far as I know).  Fixing that will take more effort and be harder to remember... -- JCW2

    Removing the NetBIOS transport has several advantages compared to NetBIOS over TCP, you can find detailed infromation in the following KB
    Direct hosting of SMB over TCP/IP
    http://support.microsoft.com/kb/204279/en-us
    Yolanda
    TechNet Community Support
    Hi again -- I think I'm slowly catching up with you.  Following from my previous message...
    Somebody on another forum mentioned creating "Hosts" files on each computer to substitute for the DNS server that I don't have on my workgroup.  This is intriguing if I can figure out how to set it up.  (I've heard it said that taking control of
    your "Hosts" file is a good safety precaution anyhow, since it is a frequent target of hackers trying to divert legitimate Web requests to their own malicious sites.)  Does anybody have tips and/or references that would help me accomplish the name resolution
    there?
    Finally, what functionality do I really lose by going the Direct-Hosting-of-SMB-with-Hosts-file (or drive mapping) route as opposed to using NetBIOS over TCP/IP?  Granted, any new machine added to the network would also have to be added to all the "Hosts"
    files (or mapped to a new drive letter) on each machine; but given that I already have to add it to the MAC filter and assign it a DHCP reservation in my router, this isn't a heavy burden for something that doesn't happen often.  Would everything then
    work the same as if NetBIOS were providing the name resolution?
    One missing piece that I see so far -- it's not obvious how this same trick would apply to printer sharing (although I'm not using that feature right now anyhow).  Could this be handled seamlessly through the "Hosts" file as well?
    Thanks and Best Regards to All -- JCW2

Maybe you are looking for

  • HOW TO USE A SINGLE PERFORM FOR VARIOUS TABLES ?

    perform test TABLES t_header. select        KONH~KNUMH        konh~datab        konh~datbi        konp~kbetr        konp~konwa        konp~kpein        konp~kmein        KONP~KRECH        FROM konh INNER JOIN konp               ON konpknumh = konhknu

  • After I connect 2 macs with firewire......

    Hi, I need help! This is what happened. I got an old Mac and a new Mac. I transferred the profile on the old Mac to the new Mac using Migration manager... all good no problem... However, now my old Mac wouldn't start... it keeps asking me to "You nee

  • How to create Absence Quotas in infotype -- 2006.

    Hi Friends, Need some urgent help. How to create Absence Quotas in infotype -- 2006.(In standard method) Any standard programe, TCODE, BAPI FM. How to Use? Pls help me urgently. Bye RAHUL

  • Year of cash effectivity mandatory for budget category 9F

    Hi, While creating a PO/Goods Issue I am getting the below error. Year of cash effectivity mandatory for budget category 9F I have activated the payment budget and commitment budget. Time horizon for payment budget is 5yrs and commitment budget is ni

  • What is the best outdoor AP that compatible with the WLC 5508?

    Dear All, hope my email finds you well i'm searching for the bes Wireless Outdoor AP that is compatible with WLC 5508 (has a lightweight Image)? I used befor the 1310 LAP but it was nightmare to me, so I do not like to use it again and i'm searching