Question About Streams

I have two threads, each with
socket.getOutputStream()).writeObject(message);
in a server, and a client reading messages from both threads (everything uses the same socket). Sometimes, a message is not recieved; is this because one message overwrites eachother, or do streams naturally lose data from time to time? Would syncronizing the threads help me at all? I really don't know how to tackle this problem.

Here's the shell of a little app I built a while ago that seems to work pretty well. Left parts of the implementation to you:
import java.io.*;
import java.net.*;
import java.util.Vector;
public class Server {
     private static class Connection implements Runnable {
          private Socket socket;
          private ObjectInputStream ois;
          private ObjectOutputStream oos;
          public Connection( Socket socket ) {
               this.socket = socket;
               try {
                    ois = new ObjectInputStream(socket.getInputStream());
                    oos = new ObjectOutputStream(socket.getOutputStream());
               } catch (Exception ex) {
                    ex.printStackTrace();
          public void run() {
               Object message;
               try {
                    while( (message = ois.readObject()) != null ) {
                    System.out.println("Read an object.");
                         // this is where you'd handle the deserialization
               } catch (Exception ex) {
                    ex.printStackTrace();
          public void sendMessage( Object message ) {
               try {
                    oos.writeObject(message);
               } catch (Exception ex) {
                    ex.printStackTrace();
     private static ServerSocket server;
     private static Vector<Connection> connections;
     public static void main( String[] argv ) throws Throwable {
          server = new ServerSocket(8080);
          connections = new Vector<Connection>();
          while( true ) {
               Connection connection = new Connection(server.accept());
               synchronized(connections) { connections.add(connection); }
               new Thread(connection).start();
}

Similar Messages

  • Question About streaming live video with FMS3

    Thank you very much for you efforts ...
    I've tested an exciting tutorial about   streaming live video with Flash Media  Server 3.5..
    every thing went good and i could see my webcam  broadcast from my machine through my web site  but unfortunately  I can't see it from any  other machine
    I'm using Microsoft windows XP SP2
    and flash  media live encoder 3
    but my web server run UNIX
    is this a  problem???
    Please send me feedback if its possible
    thank you very  much

    Dear Janaki
    Thank you very much for you efforts ....
    i've done what you asked me exactly
    this is what i got when I've opened the URL from my machine which runs the FMS
    #Date: 2010-03-25
    #Fields: x-category    x-event    date    time    x-pid    c-ip    cs-bytes    sc-bytes    x-sname    sc-stream-bytes    x-file-size    x-file-length    x-status    x-comment
    session    connect    2010-03-25    23:11:17    7932    127.0.0.1    3073    3073    -    -    -    -    200    -
    session    connect    2010-03-25    23:12:43    7932    127.0.0.1    3073    3377    -    -    -    -    200    -
    stream    play    2010-03-25    23:12:43    7932    127.0.0.1    3139    3451    mylivestream    0    -    -    200    -
    and when i opened it from another machine nothing changed or added to the log file
    is it a problem with my webserver ??? its Lunix server and my OS is windows???
    thank you very much

  • Clip Notes in CS4: questions about streaming

    I've used Clip Notes before with small, embedded files, but this is my first time with a large video that I want to stream on a server. Maybe someone can answer a few questions:
    Where do I name the movie file? The export dialog only has a place to name the PDF.
    How does the URL setting work? The documentation simply says "This is where your video file is located" but that puts the cart before the horse. How can I specify the name and location of a movie that hasn't been created yet and for which I have no control over the name? The FTP feature works great, but it's for upload only, not for naming.
    After exporting the movie and PDF, is there a way to re-generate the PDF w/o having to re-export the movie? I realized I wanted to make some changes to the PDF only (like instructions and URL), and exporting another movie will take time that isn't necessary.
    I learned here earlier that only the QuickTime option will provide player controls. But a big .mov requres a streaming server, which I don't have. The .wmv option has the opposite problem. Does anyone know of a workaround (or other method entirely) that will use Flash video? FLV or F4V will do progressive downloading with small file sizes for online viewing.

    Where do I name the movie file? The export dialog only has a place to name the PDF.
    The name you assign to the PDF is also assigned to the exported movie file, regardless of whether you use QT or WMV. So, if you set the name of the PDF in the Export Settings to "clipnotes.pdf", the video will be either "clipnotes.mov" or "clipnotes.wmv", depending on the format you've chosen.
    How does the URL setting work? The documentation simply says "This is where your video file is located" but that puts the cart before the horse. How can I specify the name and location of a movie that hasn't been created yet and for which I have no control over the name? The FTP feature works great, but it's for upload only, not for naming.
    See above. Since you now know what the filename will be, you just have to decide where the file will reside on your server, and input this into URL field. Using our example from above, you'd use enter something like "http://www.mysite.com/upload/clipnotes.mov". It's a full URL, with the "http://" needed; just change the pertinent details.
    After exporting the movie and PDF, is there a way to re-generate the PDF w/o having to re-export the movie? I realized I wanted to make some changes to the PDF only (like instructions and URL), and exporting another movie will take time that isn't necessary.
    Maybe, though I haven't tested this:
    Trash the original PDF file.
    Temporarily rename your originally-exported movie file, or move it to a different folder so that it's not overwritten.
    Set your export range to one frame, using the same settings and same name that you did for your first export, and restart the export.
    Throw away the new movie file, and rename the original or move it back to it's original folder. Since the only connection the PDF has to the movie file is the URL and filename, this should work.
    I learned here earlier that only the QuickTime option will provide player controls. But a big .mov requres a streaming server, which I don't have. The .wmv option has the opposite problem. Does anyone know of a workaround (or other method entirely) that will use Flash video? FLV or F4V will do progressive downloading with small file sizes for online viewing.
    I don't think you need a streaming server; I've tested QuickTime off a regular ol' HTTP server and it works fine. Incidentally, I should add, QuickTime streaming WASN'T working for me previously, at all. I just tried it out, and it would seem that a recent update to Adobe Reader might have fixed the issue. Streaming WMV always worked fine. Curious.
    As far as Flash: are you talking about using Flash Video in ClipNotes, or just Flash Video viewing online, in general? At this time, ClipNotes is QuickTime or WMV only, but I wouldn't be suprised if Flash Video makes an appearance in ClipNotes CS5, given the whole focus on Flash in the Adobe ecosystem. If you're talking about general FLV playback, check out the JW FLV Media Player; it's an fairly simple-to-configure Flash Video player that can be embedded into a webpage.

  • Few questions about streams configuration

    Hi all,
    I am currently setting up a test streams environment while going through the documentation, and had a few questions. This will be for a 10.2.0.2 environment across two databases.
    1) If I setup a streams admin account of "strmadm", and create the queue under this account. Is it possible to have other user accounts create the rules for the capture and apply? The documentation mentions granting dba to the strmadm account, and we would be prevented from allowing the application developers to have access to this account.
    2) What are some of the best sources of info for 10g streams? I have doc 298877.1 and the Oracle documentation, but was wondering if there were any other good sources of info.
    3) Our current plan is to have the capture, stage, and propagation monitored by the DBA team, while the apply is managed and coded by the developers. We were thinking to do this we would create a strmadm account in each database, with a queue created by strmadm. We would have a local capture done on database A, and propagate the LCRs to the queue on database B. Once the messages were in queue on database B, it would be the application developers who were responsible for writing the code to properly apply the messages. Does this make sense from a high level, or am I missing something?
    Thanks for the help

    1)
    Sure. You can use any name. even multiple dfifferent accounts.
    DBA is requared.
    2)
    298877.1 is good document but for 10gR1
    You can use Streams docs. Just search DBMS_STREAMS_ADM.MAINTAIN... procedures. You will find good source somethere close.
    3)
    I think DBA team should be responsible for everything excluding DML handlers.
    Regards,
    Sergey

  • Questions about streaming disk, firewire and SATA raids.

    I have two internal drives, one for applications/system and one for audio, which had been suitable up until recently. I recently added Ivory, and some addons to the BFD drums. The BFD Deluxe has significantlly more velocity layers, and is placing a strain on computer and drives.
    I moved the BFD drum data onto an external firewire 800 (because of data size) The BFD drums seem to be having a hard time keeping up, (it glitches and stutters).
    I have 3 gig of ram, so I guess I'll add more ram. But I'm unsure about SATA raids. Is it better to add an external firewire RAID?... Mac Guru, has some reasonably priced kits. Has anyone had experience with them?
    There is a 3 drive bay which you can put inside your G5, but I have concerns it will draw too much power and generate too much heat.
    Lastly, if I buy a 4 bay external raid, can i create a 3 drive raid, and keep 1 one drive as a seperate drive (do I have to stripe all drives in one enclosure, or can they be seperate?
    Any insights would be helpful.. thanx

    depending on whether you use eSATA or FW, you have differnet options as to how you mount the drives as volume(s) to your computer. FW pretty much limits you to a single logical volume, although it could be RAID-0 or in some rare instances, RAID-5 with certain enclosures.
    eSATA, again, depending on the specific enclosure, can mount all the drives as a single volume, but you may have the option to mount multiple logical volumes... like the 1 RAID-0 and 1 independent volume like you mentioned.
    earlier tonight i recommended this drive to someone else for a laptop application...
    http://www.lacie.com/products/product.htm?pid=10724
    for a desktop application, you would probably go with their 3.5" solutions since buss power is not important to you.
    this might not be accurate, but this is my understanding of highest read/write performance to lowest in terms of general specs (certain products may have advantages / dissadvantages depending on the implementation) all RAID-0 volumes are assumed to be 2 drive RAID, although it is technically possible to do more with certain hardware.
    1) RAID-0 eSATA
    2) RAID-0 FW
    3) RAID-5 eSATA
    4) single eSATA
    5) single FW
    6) RAID-0 USB2
    7) RAID-5 FW
    8) single USB2
    9) RAID-5 USB2
    RAID-5 is a real wild card here because a 3 drive image is really not the intended configuration for RAID-5... more drives is preferred before you start reaching theoretical efficiency and the actual XOR engine or lack of one can drastically affect your performance levels.

  • Question about streaming videos online

    Can I change a setting so my screen doesn't go dark while I'm streaming movies online. It gets a little annoying that I have to hit the keypad every 35 seconds while watching a movie. Thanks for the help!

    You need to change the "Display Sleep" settings under Apple Menu -> System Preferences... -> Energy Saver.

  • Question about streaming

    When I go to start streaming in Fme I noticed where it says average on the bottom that the frames drop past 2000 under ouput. Is that normal? On the top where its says current those 0 drops. I'm streaming to justin tv, my currents settings are set to: format- vp6, fps 25.00, input size 640 x 480, output size 640 x 480, bitrate 650. audio format mp3 , channel stereo  sample rate 44100 Hz, bitrate 128. Are my settings okay or to high. I'm ruuning on a single core 2.20 ghz laptop. Is whats under "current" what the viewers are seeing live?

    Output drops means CPU power (as here single core), RAM and internet upload speed is not capable to handle stream you mentioned.  To fix this, you can try lowering resolution and/or FPS. Also switch to H.264. You will get less frame drops from that codec with your setup.
    And if you are not using FMLE 3.2, please install it from : http://www.adobe.com/products/flashmediaserver/flashmediaencoder/

  • Question about streaming music using AE with Time capsule

    I have a time capsule with over 120gb of music stored on it. I'd like to be able to stream this music directly from the time capsule to an airport express connected to a stereo in another room. I do have an iPhone 3G with the remote app. (I have not got the airport express, yet.)
    I am really hoping that I can use the iPhone remote app to control the music playing through the airport express, without having to have a computer turned on and runing iTunes.
    I believe this is possible with Apple TV, but since I don't own a TV or monitor other than my laptop screen, that isn't the most practical solution.
    So, can I use airport express to stream music from a time capsule, without having to run iTunes on my MacBook?
    Thanks.
    SevenDog

    No.
    You would have to have itunes running in order to stream music, or, as you point out, have an appleTV

  • Question about streaming video

    Hi-- I'm trying to figure out why some .wmv and .rm videos automatically begin to download to my Mac, when others just pop a new windows and play like I thought they were supposed to? For instance, the videos on this site: http://www.blackholebindhi.com Whenever I click on them, they download as opposed to the .wmv files here: http://www.louismandylor.com/trailers.shtml which pop the new window and play automatically. Any idea why this is? What is causing the difference in playback?
    G5   Mac OS X (10.4.2)  

    They're not really streaming Streaming is a term that is literally applied to live events or playback of a file; broadcasting.
    You're seeing the difference between hinting and downloading. Hinted files will start as soon as enough material has been received to fake a live reception. Playback stalls if playback exceeds the download speed. Other files are flagged to be downloaded first. It is part of the authoring process when you create the file, you can set all kinds of flags that control the viewer's experience. Controls or none, full screen jump, enabled save or not, lots more.
    bogiesan

  • Question about streaming h264 in flv file

    I read an article at "
    http://www.kaourantin.net/2007/08/what-just-happened-to-video-on-web_20.html"
    which is a blog of an software engineer of Adobe, the author said
    in this article that "...There are functional limits with the FLV
    structure when streaming H.264 which we could not overcome without
    a redesign of the file format..." and "...Specifically dealing with
    sequence headers and enders is tricky with FLV streams...", does
    anybody know what exactly the author mean? what is the "functional
    limits"? how to "specifically dealing with sequence headers and
    enders"? is it a way to solve the "functional limits"?
    Thanks!

    Hi, anybody help me?

  • Question about streaming itunes music files (AAC Format) to my Sony Bravia TV.

    I am streaming iTunes music files tfrom my Laptop to my Sony TV; the files are in AAC format.   However a Sony technician said I need to convert them to MP3 for the streaming to work properly.
    It seems to work OK without converting them so why should I convert them?
    And more importantly, if I convert them to MP3, will iTunes continue to work right?  And will iTunes still synch to my Nano and to my iPhone4?
    Thanks for any wisdom you all can offer.

    No.
    You would have to have itunes running in order to stream music, or, as you point out, have an appleTV

  • Question about streaming and space on the original apple tv

    When I first got the original apple tv I thought that the device will work with itunes fill out the hard drive and anything else it can't fill up it will just stream.
    I have my itunes setting on automatic sync and I keep getting a ! next to apple tv saying there is not enough room. I want to be able to stream all of my photos and videos and music and not get this error message. Am I using this wrong?
    I would consider upgrading to the new apple tv except for 2 reason. I only have a DVI input on my tv and not an HDMI input- Secondly, If I go to rent a movie for $3 and I had the option to buy for $9 more often than not I will just buy it for $9.

    iTunes may simply ge telling you AppleTV is full rather than just not streaming the rest.
    Are you certain things are not streaming? If so check that the option 'shoe only synced items' isn't ticked in appleTV preferences tabs in iTunes.

  • Question about streaming and Internet

    When my Internet goes out, I can't stream content from my computer.  But since it's streaming locally from my computer, shouldn't the WLAN from the Airport Extreme Base Station be enough?  Why won't it stream if the connection to the Internet is lost?

    I'm sure, it's the Internet.  Lots of squirrels in the area, and they keep running on the cable lines outside and makes the Internet, phone, and cable TV go out all the time.  Cable company has to come by at least twice a year and replace damaged wires.

  • Questions about mac mini iTunes server, streaming to macbook pro, ipads, etc.

    I'm thinking about getting a mac mini to work with my NAS as a iTunes server. I have a bunch of questions about this. I will have two iPhones, a few iPads, and a laptop that will be accessing the files. I have iTunes match. This is basically to keep an always on computer for hosting the music/movies. My questions are as follows . . .
    #1 Are there any good, comprehensive guides to show you how to do this?
    #2 Can the movies be accessed when not at home on the shared network?
    #3 Can the iPads or the macbook pro download the shared movies to be stored locally?
    #4 Back to #3, how will it work on my macbook pro with listening to music (I have iTunes match)? Say i go to library and I break out my macbook pro and I don't have internet. What happens if I download music while at home onto my macbook pro to listen to it when I go to the library? Will i start a new library on my macbook pro? How will that mesh with the home server when I come back.
    #5 Is there a way to mirror files or folders? So something that I have on my macbook pro will also mirror on the home server.
    Thanks for your help on this. I'll post any follow up questions.

    seanfenton wrote:
    1. I want to replace the Optical drive with a 2TB SATA. can I use this 2.5 inch?
    I do not know if it is the same model number, but this one will work in your MBP:
    http://eshop.macsales.com/item/SEAGATE%20OWC/ST2000LM003M/
    2. I want to replace the HD with a 128GB SSD 840. When I replace these drives, will my OS still be in tact? I have never done this job before.
    No. You will have to format the drives in Disk Utility>Erase to Mac OS Extended (Journaled) and then install the OSX by using the original install disks.
    3.) I want to replace the ram sticks to max capacity. This is 2 2GB sticks, Correct?
    No.  An early 17" 2008 MBP will accept 6GB RAM with the following specifications:  200-pin PC2-5300 (667MHz) DDR2 SO-DIMM.  The best sources of Mac compatible RAM are OWC and Crucial.
    4.) Most difficult...
    I want to extend the monitor wirelessly to a projector. I thought about using Apple TV and Airplay. However, support for airplay is for MacBooks 2011 and newer. I thought of using a PS3 and the media server, but I think this brings on a format compatibility issue. (my library is so large I could not afford to convert all my movies to MP4.) So, how would you recommend I put my extended monitor with VLC player onto a projector?
    Could I possibly connect the MBP to a Mac Mini as an extension? would this work natively? I would rather use a VGA cord than F with 3rd party app BS.
    Cannot help you there.
    5..) I want to Bypass iTunes this time around. I would prefer to use Finder and VLC to manage all of my music. I mostly play all my music on shuffle, so, could I create a playlist on VLC with all of my music and play it randomly? (im sure this is possible but i'd like to organize all my plans with confirmation.)
    You are not obligated to use iTunes.
    6.) Can i upgrade the keyboard to backlit? i've read that this is possible.
    All MBPs have back lighted keyboards.  Your either needs a NVRAM reset or a repair.
    Ciao.

  • A lot of questions about my MacBook Air

    I am really new to re-using Apple computers.The last time I used an Apple computer was back in 1987 when the school and my family had Apple IIGS computers. I have been using PC's which reqiure Microsoft. I a lot of have questions (10 questions) about my MacBook Air and I hope you good people can and will help me.
    Product: MacBook Air
    Operating System: Mac OS X Version 10.7.4
    1) I Downloaded MacKeeper because I was fooled. I had a bad feeling just before I Downloaded it and I should have listened to my heart. However, I didn't buy it or fully Install it. It was like a test run and then they wanted me to pay almost $100 for it. Thankfully, I didn't because I read it is Malware. I spoke with an Apple Tech at Apple Care and he helped me get rid of it (or so we think). I don't see it anymore on my computer. I read it can slow down your computer. How can you tell if it's really off of the computer?
    2) When I open "Finder" and I see that there are people Sharing my computer with me. I went into AirDrop and it reads, "Other people can see your Mac as (my name) MacBook Air when their computer is nearby." I bought a HotSpot and while it's turned on and I selected it as my WI-FI connection I thought it would  get rid of these people, protect what I type, me, my items, computer, etc. But it didn't.  
    I didn't know that I have to buy a exteral CD and/or DVD Player in order to connect to the brand new Modem and Router in one by NetGear. I am so used to PCs and the CD/DVD Players being built inside.
    The people at Apple Store told me that there is an internal modem inside, but I don't know how to find it and what to do then.  Should I use a Firewall?, An AntiVirus, AntiMalware, AntiSpyware, etc. Apple Care tech told me I don't need to get an AntiVirus.
    3) Is there a new kind of Wireless Modem and Router that doesn't require a CD-ROM?
    4) When I travel or fly and I am not close to home I was told by Best Buy and Sprint that I had to buy a mobile HotSpot to use the computer (WI-FI) safely. As I typed, I have one. But it's pretty expensive and only gives me 1 hour and 15 minutes per day to Stream. What can I do to use this computer safely Online when I am out of range from a Modem and Router? What do people do when they travel on airplanes?  
    5) This compter won't let me use "Raid." I think you have to have a newer version. I hard about Raid on the radio from Leo (can't recall his last name) who's a Tech expert.
    6) Should I buy a ZipDrive? Apple Store Tech told me that I didn't need a ZipDrive. I just remember the episode of HBO's "Sex and The City" when Carrie looses everything because her copy crashed. Now, of course, I know that's a fictional show, but with PC's and Microsoft I have lost everything when it crashed, frooze up, etc. I know there's iClouds. I heard about Carbonite, but I have read the Pros and Cons about it. Mostly they are Cons about it. I just don't want to do anything wrong and mess up this computer.
    7) Should I buy a new Printer/Copier/Scanner because mine is an HP. It's not new, but it works. I even have a CD-ROM for Macs. What about the new product called, "Neat"?
    8) Is there a special product that I should buy to do Online Banking and/or other important stuff?
    9) I saw and read about iWork in the Apps Store and it sounds cool. I still have alot of friends and colleagues who still use Microsoft. Is iWork good to use? Should I Download it from the Apple Apps Store or can a buy it at Apple? Is there another Word Processing Program that is great and user friendly and will work with Macs and PCs?
    10) Should I Update the OS with OS X Mountian Lion Pro from the Apple Apps Store or buy it at Apple Store?
    In advance, I wish to thank you in this Apple Support Communites for your help.  Have a safe and happy holiday weekend!

    1) Here are instructions for removing MacKeeper. Since it mostly consists of manually looking for folders and specific files, if you follow the instructions you either fail to find what you are told to find (because your AppleCare guide gave you complete instructions which you followed) or you'll find some additional files that need to be replaced.
    2 & 3) I assume you are looking at the sidebar of a Finder window and seeing Shared and computers under it. Those are computers that you can potentionally share. To do so you'd need an account on their computer and a password. They are not sharing your computer.
    AirDrop allows you to create an adhoc network for filesharing and it only functions when you have selected the AirDop item in the SideBar. Actually doing that merely announces to computers in the same network node that your computer is available for a file to be sent to. Even then you have to explicitly allow the file to be downloaded to your computer. Similarly you'd be able to see other computers with AirDrop selected and be able to send them a file - which they'd have to accept.
    The only reason your NetGear Router comes with a CD is to install and run their 'easy' step by step configuration program. It can also be done manually with a browser. Read the manual to find the IP address you must enter to access the router's configuration menu. Apple's WiFi routers don't require a CD to install the software because the configuration software is already on your computer.
    I do have my firewall turned on. AntiVirus software isn't a bad idea - I use Sophos having tested it for a review for our local User Group and I found I liked it better than ClamAVx which is what I'd been using before. Both are free.
    4) I think you were scammed by Sprint and BestBuy. I use hotel, coffee shop, and restaurant WiFi spots and have for years. However, because they can be unsecured, I do not shop online or bank when I'm using them. I also use 1Password and don't reuse passwords so even if a sniffer should grab an account and password that's all it would get - one account.
    5) Raid doesn't really make sense with a MacBook Air - a RAID involves 2 or more disks being used as if they were one.
    6) Zip drive? No. External hard drive - yes. It isn't a question of if a computer's hard drive will malfunction, it is when. OWC has a nice selection of external drives and the Mac has a built in backup system called TimeMachine. Due to the way TimeMachine works, I've found that your TimeMachine drive should be at least twice as large - and preferably 3-4 times as large as the data you are backing up.
    7) if your printer works and it has Mountain Lion drivers, why replace it?
    8) Online banking is done with a browser - Use Safari or FireFox
    9) If trading files with Windows users is important Mac: Office is your best bet. If not, iWork, Mac:Office, or LibreOffice are all good possibilities.
    10) you can only buy Mt Lion via the App Store.

Maybe you are looking for