Datagram socket reads its own output?

If I use a DatagramSocket to broadcast UDP packets, and also use the same DatagramSocket to try and read broadcasts from other hosts, it looks like I also end up reading back in all the packets that I broadcasted which creates a really messy situation.
The only way I've found around this is to check the host address on every packet that comes in the door. This seems a little processor intensive if you're dealing with a lot of UDP traffic.
Is there a better way around checking every packet? Being new to DatagramSocket, it seems odd to me that I use the same socket for reading and writing (hopefully it is threadsafe) but it is my understanding that I am using it correctly.

OK, I guess that explains it. Since I'm dealing with
DIS packets (Distributed Interactive Simulation),
everything needs to be port 3000 because that is what
all the systems talk.
On multi-homed boxes I think I'll have to compare the
packet's host address against each host address on
the box. I guess I'll just tryt and do it in the
most efficient manner possible... i.e. NOT a
string.equals()And then what?
What if the client is running on the same box as the server?

Similar Messages

  • Applet not opening a socket on its own host. Please help.

    I have also posted this in JSC2 forum.
    My applet is not able to open a socket on its own host.
    The applet is being served by a JSP (developed using Sun Creator2) from my laptop behind a DHCP broadband router at (say) 125.238.104.132 at my residence. I have a URL �samsub.no-ip.biz� that redirects port 80 calls to 29080 where my application runs. All required router rules/mapping are done and the JSPs run perfectly fine. In one of the pages, I have inserted an applet inside an escape disabled statictext field as follows:
    <applet code="AppClient.class" width=540 height=440></applet>
    The applet code and the test server code are shown below for your analysis. Note that, when run on the same machine (at home), the applet works fine. The commented lines will show other failed test. The error reported at the java console was: null pointer at line 56
    Could someone help me please. Thanx. MarySam
    The applet code
    1     import java.util.*;          
    2     import java.awt.*;          
    3     import java.applet.*;          
    4     import java.text.*;          
    5     import javax.swing.*;          
    6     import com.sun.java.swing.plaf.windows.*;          
    7     import java.awt.event.*;          
    8     import java.net.*;          
    9               
    10     public class AppClient extends Applet {          
    11     JInternalFrame jif;          
    12     JTextArea jta1, jta2;          
    13     Socket kkSocket = null;          
    14               
    15     public void init() {          
    16          try {     
    17               LookAndFeel lf = new WindowsLookAndFeel();
    18               UIManager.setLookAndFeel(lf);
    19          kkSocket = new Socket("125.238.104.132", 4444);
              //kkSocket = new Socket("samsub.no-ip.biz", 4444);
              //kkSocket = new Socket("125.238.104.132:29080", 4444);
              //kkSocket = new Socket("samsub.no-ip.biz:29080", 4444);
    20          }      catch(Exception e) {}
    21               
    22          setLayout(null);      
    23          setBackground(Color.black);     
    24          jif = new JInternalFrame();     
    25          jif.setLocation(20,20);     
    26          jif.setSize(500,400);     
    27          Container con1 = jif.getContentPane();     
    28          con1.setLayout(null);     
    29               
    30          jta1 = new JTextArea();      
    31          JScrollPane jcp1 = new JScrollPane(jta1);     
    32          jcp1.setBounds(10,10,410,100);     
    33          con1.add(jcp1);     
    34               
    35          jta2 = new JTextArea();     
    36          JScrollPane jcp2 = new JScrollPane(jta2);     
    37          jcp2.setBounds(10,115,470,245);     
    38          con1.add(jcp2);      
    39               
    40          JButton jb = new JButton("Go");     
    41          jb.setBounds(425,10,60,30);     
    42          jb.addActionListener(this);     
    43          con1.add(jb);      
    44               
    45          JLabel jlb = new JLabel();     
    46          jlb.setOpaque(true);     
    47          jlb.setBackground(Color.gray);     
    48          jlb.setForeground(Color.white);      
    49          jlb.setBounds(425,50,60,30);     
    50          con1.add(jlb);      
    51               
    52               
    53          jif.setVisible(true);     
    54          add(jif);      
    55          //jta2.setText(getCodeBase().toString());     
    56          jta2.setText(kkSocket.getInetAddress().toString());     
    57               
    58     }          
    59               
    60     public void start() {}          
    61               
    62     public void stop() {}          
    63               
    64               
    65     }          
    66               
    67               
    The test server Code
    1     import java.net.*;                         
    2     import java.io.*;                         
    3                              
    4     public class MyServer {                         
    5     public static void main(String[] args) throws IOException {               
    6                              
    7     ServerSocket serverSocket = null;                    
    8     try {                         
    9     serverSocket = new ServerSocket(4444);                    
    10     } catch (IOException e) {                         
    11     System.err.println("Could not listen on port: 4444.");          
    12     System.exit(1);                         
    13     }                         
    14                              
    15     Socket clientSocket = null;                         
    16     try {                         
    17     clientSocket = serverSocket.accept();                    
    18     System.out.println(clientSocket.getInetAddress().toString());          
    19     } catch (IOException e) {                         
    20     System.err.println("Accept failed.");                    
    21     System.exit(1);                         
    22     }                         
    23                              
    24     clientSocket.close();                         
    25     serverSocket.close();                         
    26     }                         
    27     }                         
    28                              
    29

    Hi Guys,
    I'm not actually from Mozilla Firefox, but I've had this problem before, and I've solved it with the help from another website.
    What you need to do is download a programme called "tdsskiller" from here:
    http://www.geekpolice.net/t23369-computer-infected
    scroll down the page and you should see a link. (I know the article itself seems irrelevant to your problem, but trust me, the programme they recommend works on this virus too.) It's only 1.3MB or so, so it doesn't take up huge amounts of space either! :)
    I can safely say that it is COMPLETELY safe to download this from geekpolice.net, as this website is a free website which helps people with viruses on their computer. If you ever have another problem with anything to do with computers, go and have a look on geekpolice.net, they should have something that might help you.
    Before anyone wonders why I am singing its praises so much, no I am not advertising them for any personal gain, but they have helped me get rid of some pretty nasty viruses on my computer before, so I am very grateful to them :)
    SO, anyway, after you've downloaded the tdsskiller, you should run it, and it may find some infected files, in which case let it repair them. After rebooting your computer, the annoying opening tab thing should be gone!
    I hope this works for anyone who's stuck :) If it doesn't, I'm really sorry, but it has definately worked for me!
    Good luck!
    Yashmeee :)

  • ITunes can't read its own library/claims damaged

    I'm running iTunes 11.1.1 on OSX 10.8.5 on a late 2012 Mac Mini. iTunes 10.x started complaining on startup that the library file is damaged and can't be read. This persists today after upgrading iTunes.
    After starting and renaming the old library, it shows my purchased music from iTunes Store, with horribly broken album cover art. I've tried re-importing my music and after reading it all in it is unable to access the saved library after restart.
    This began on a RAID drive, and I've the same issue on my Mac's internal drive when I change the media directory.
    iTunes can read a saved version from June 2013 that it backed up, but upon exit and restart, it complains that the library is damaged.
    Any help would be appreciated.

    What's the option key? I think I'm having the same problem, except I moved my library to defrag the drive and them moved it back. And now iTunes doesn't see my info or playlists or anything...

  • My iPad shut down on its own and when i switched it on, it asks to 'Activate iPad' and reads below 'This iPad was lost and erased. Sign in with the Apple ID that was used to erase this iPad". Please help!!!!

    my iPad shut down on its own and when i switched it on, it asks to 'Activate iPad' and reads below 'This iPad was lost and erased. Sign in with the Apple ID that was used to erase this iPad". Please help!!!!

    Is it possible that you or someone who knows your iCloud sign on went into the Find My iPhone app and erased your device via iCloud? Because that is what that message is saying.
    Have you tried to sign on with your Apple ID and password?
    Was it online prior to this incident happening?
    GB

  • How to execute some code in command line, and read its output?

    I'v found here http://www.sap-advisor.com/abap-coding/how-to-execute-operating-system-commands-from-within-sap/ that I can execute commands from the windows command line for example inside SAP.
    But I want to take it one step further and read its output. is it possible?

    Hi RagnaRock,
    one possible approach can be outputting the results of the command into a text file (i.e. "command >result.txt"), and then read this file from SAP/ABAP.
    I hope this helps. Kind regards,
    Alvaro

  • Phone turns off ringer on its own & I can't turn back on! Plz Read!

    This phone has actually been more headaches then it was worth so far. I'm actually have a couple problems with this thing, all related to the sound/ringer. For some reason for the past month all on its own it'll just turn off my ringer somehow, but when I go into the profile, nothing has changed. It still says vibrate & tone are on. The ringer is still set the way I want it, but it doesn't do any kind of sound when it gets called or texts/pics, will only vibrate. Does that twice, then nothing, no ring, no matter how many times I go into the profiles & change the settings (with saving it), or even change profile from loud to normal to off & so on. Even taking the battery out doesn't do a reset everytime. Plus I'm getting tired of having to take the battery out cause I then have to take of the hard plastic case on it & always end up cracking it so have to spend another $5 for a new one, but thats a different thread on how to open a case.
    The second problem is probably related to the first one, but her goes. When I do go into the ringer profiles, when I scroll to a new song/sound for a ringer, it doesn't play a preview of what it is anymore, so I know I screwed something up somewhere.
    How do I get this stupid thing to start ringing again? Actually I just tested the alarm & that doesn't even work correctly, no sound. Am I somehow hitting a button when I silence, ignore the call since I don't press the red hang up button? Any and all help it greatly appreciated.

    Me Too, Help!!! it just started today and is driving me crazy , some one please help!!!!!!

  • My Macbook Pro started freezing all the time & going to sleep on its own for no reason

    I've been having trouble for a few weeks with my computer freezing way too often for seemingly no reason - I'm using it exactly the same way I always have with no problems, and even actively trying to have less applications open (which seems to have no effect). I can't always load simple webpages without it freezing and giving me the color wheel and it's just MUCH slower in general. It is seriously making it difficult to use my computer for work  or for fun...
    It has also started going to sleep on its own - the screen will just go black (or sometimes BLUE) and the keyboard lights turn off, and the only way to get it to wake back up is to close the computer, wait, open it again and click or press a key. It doesn't respond to any keys/clicks until it has been closed and reopened.
    It seems to overheat really easily lately as well - but it does not always overheat when it freezes.
    SMC reset did not seem to have an effect. Activity Monitor doesn't show anything crazy, everything is pretty much 0% except Firefox around 7-12% as I'm typing this. 246 GB available on my hard drive so that doesn't seem to be the problem either. Right after restarting my computer it seems better but the problems quickly resurface...
    I googled for help before posting this and someone had suggested running the command
    syslog -k Sender kernel -k Message CReq 'Channel t|GPU D|I/O|find tok|n Cause: -' | tail | open -ef
    in Terminal, which they said "Normally the command will produce no output, and the window will be empty." But mine gave this:
    Tue Apr 15 21:04:24 My-MacBook-Pro kernel[0] <Debug>: disk0s2: I/O error.
    Tue Apr 15 21:04:42 My-MacBook-Pro kernel[0] <Debug>: disk0s2: I/O error.
    Tue Apr 15 21:35:04 My-MacBook-Pro kernel[0] <Debug>: disk0s2: I/O error.
    Tue Apr 15 21:35:20 My-MacBook-Pro kernel[0] <Debug>: disk0s2: I/O error.
    Wed Apr 16 10:56:46 My-MacBook-Pro kernel[0] <Debug>: disk0s2: I/O error.
    Wed Apr 16 10:57:03 My-MacBook-Pro kernel[0] <Debug>: disk0s2: I/O error.
    Wed Apr 16 12:11:17 My-MacBook-Pro kernel[0] <Debug>: disk0s2: I/O error.
    Wed Apr 16 12:11:35 My-MacBook-Pro kernel[0] <Debug>: disk0s2: I/O error.
    Wed Apr 16 12:11:52 My-MacBook-Pro kernel[0] <Debug>: disk0s2: I/O error.
    Wed Apr 16 12:23:01 My-MacBook-Pro kernel[0] <Debug>: disk0s2: I/O error.
    I don't know what that means or if that is useful info to help solve my problem? I just want to know what I can do to make my mac go back to normal!
    I ran Etrecheck:
    Hardware Information:
        MacBook Pro (15-inch, Early 2011)
        MacBook Pro - model: MacBookPro8,2
        1 2 GHz Intel Core i7 CPU: 4 cores
        4 GB RAM
    Video Information:
        AMD Radeon HD 6490M - VRAM: 256 MB
        Intel HD Graphics 3000 - VRAM: 384 MB
    System Software:
        Mac OS X 10.6.8 (10K549) - Uptime: 0 days 0:24:42
    Disk Information:
        Hitachi HTS725050A9A362 disk0 : (465.76 GB)
            (null) (disk0s1) <not mounted>: 200 MB
            Macintosh HD (disk0s2) / [Startup]: 465.44 GB (229.26 GB free)
        MATSHITADVD-R   UJ-898 
    USB Information:
        Apple Inc. FaceTime HD Camera (Built-in)
        Apple Inc. BRCM2070 Hub
            Apple Inc. Bluetooth USB Host Controller
        Apple Inc. Apple Internal Keyboard / Trackpad
        Apple Computer, Inc. IR Receiver
    FireWire Information:
    Thunderbolt Information:
        Apple, Inc. MacBook Pro
    Kernel Extensions:
        com.digidesign.iokit.DigiDal    (8.0.3f1)
        com.paceap.kext.pacesupport.snowleopard    (5.7.2)
    Startup Items:
        DigidesignLoader: Path: /Library/StartupItems/DigidesignLoader
        M-AudioFastTrack: Path: /Library/StartupItems/M-AudioFastTrack
        PACESupport: Path: /Library/StartupItems/PACESupport
    Problem System Launch Daemons:
        [System]    org.samba.winbindd.plist 3rd-Party support link
    Launch Daemons:
        [System]    com.adobe.fpsaud.plist 3rd-Party support link
        [System]    com.google.keystone.daemon.plist 3rd-Party support link
        [System]    com.microsoft.office.licensing.helper.plist 3rd-Party support link
        [System]    org.eyebeam.SelfControl.plist 3rd-Party support link
        [System]    PACESupport.plist 3rd-Party support link
    Launch Agents:
        [System]    com.google.keystone.agent.plist 3rd-Party support link
        [System]    com.hp.help.tocgenerator.plist 3rd-Party support link
        [System]    com.m-audio.mobilepremkii.helper.plist 3rd-Party support link
    User Launch Agents:
        [not loaded]    com.apple.CSConfigDotMacCert-[...]@me.com-SharedServices.Agent.plist
        [not loaded]    com.facebook.videochat.[redacted].plist 3rd-Party support link
        [not loaded]    com.spotify.webhelper.plist 3rd-Party support link
    User Login Items:
        Flux
        iTunesHelper
        RescueTime
    Internet Plug-ins:
        o1dbrowserplugin: Version: 5.2.4.18058 3rd-Party support link
        nplastpass: Version: 2.5.5 3rd-Party support link
        Unity Web Player: Version: UnityPlayer version 3.5.2f2 - SDK 10.6 3rd-Party support link
        RealPlayer Plugin: Version: Unknown
        Silverlight: Version: 5.1.20913.0 - SDK 10.6 3rd-Party support link
        FlashPlayer-10.6: Version: 13.0.0.201 - SDK 10.6 3rd-Party support link
        QuickTime Plugin: Version: 7.6.6
        Flash Player: Version: 13.0.0.201 - SDK 10.6 3rd-Party support link
        googletalkbrowserplugin: Version: 5.2.4.18058 3rd-Party support link
        SharePointBrowserPlugin: Version: 14.4.1 - SDK 10.6 3rd-Party support link
        AdobePDFViewer: Version: 10.1.1 3rd-Party support link
        iPhotoPhotocast: Version: 7.0 - SDK 10.7
        JavaAppletPlugin: Version: 13.9.8 - SDK 10.6 Outdated! Update
    iTunes Plug-ins:
        Quartz Composer Visualizer: Version: 1.2
    3rd Party Preference Panes:
        Flash Player  3rd-Party support link
        Growl  3rd-Party support link
        M-AudioFastTrack  3rd-Party support link
        M-Audio MobilePre  3rd-Party support link
    Old Applications:
        None
    Time Machine:
        Time Machine information requires OS X 10.7 "Lion" or later.
    Top Processes by CPU:
             5%    firefox
             3%    EtreCheck
             2%    WindowServer
             2%    hidd
             1%    mds
    Top Processes by Memory:
        545 MB    firefox
        74 MB    mds
        57 MB    WindowServer
        41 MB    Mail
        41 MB    Finder
    Virtual Memory Information:
        1.88 GB    Free RAM
        818 MB    Active RAM
        458 MB    Inactive RAM
        880 MB    Wired RAM
        190 MB    Page-ins
        0 B    Page-outs

    Eric - I dont understand how I'd use caffeinate.  I am not running any code or particular script.  My system goes to sleep if surfing the web, or running Word or Excel, etc. 
    Or..  Are you saying I should go through and type 'caffeinate X' for all of my applications?

  • My Mac got hacked. I was working on a word document when the computer suddenly started typing meaningful sentences on its own that describes how the hacker is skillful. At the that time I was on a password protected wifi and file sharing was off.

    This is the first time I get hacked this bad. I was working on a microsoft word document when the computer suddenly started typing meaningful sentences on its own that describes how skillfull the hacker is. At the that time I was on a friends wifi network that is password protected (not sure about the encyrption), the Os X Firewall was on. I was using the admin profile, however, file sharing was off. I'm very careful not to install any suspecious 3rd party software.
    So far I have verified permissions and fixed some errors there, and changed passwords.
    Do I have to erase/format my computer and reinstall the Os? If so is it adequte to use the internet recovery tool or will it use old and possibly infected EFI/Root files?
    Would appreciate the advice of all the Mac experts out there. Thanks

    Please read this whole message before doing anything.
    This procedure is a diagnostic test. It won’t solve your problem. Don’t be disappointed when you find that nothing has changed after you complete it.
    Third-party system modifications are a common cause of usability problems. By a “system modification,” I mean software that affects the operation of other software — potentially for the worse. The following procedure will help identify which such modifications you've installed. Don’t be alarmed by the complexity of these instructions — they’re easy to carry out and won’t change anything on your Mac. 
    These steps are to be taken while booted in “normal” mode, not in safe mode. If you’re now running in safe mode, reboot as usual before continuing. 
    Below are instructions to enter some UNIX shell commands. The commands are harmless, but they must be entered exactly as given in order to work. If you have doubts about the safety of the procedure suggested here, search this site for other discussions in which it’s been followed without any report of ill effects. 
    Some of the commands will line-wrap or scroll in your browser, but each one is really just a single line, all of which must be selected. You can accomplish this easily by triple-clicking anywhere in the line. The whole line will highlight, and you can then copy it. The headings “Step 1” and so on are not part of the commands. 
    Note: If you have more than one user account, Step 2 must be taken as an administrator. Ordinarily that would be the user created automatically when you booted the system for the first time. The other steps should be taken as the user who has the problem, if different. Most personal Macs have only one user, and in that case this paragraph doesn’t apply. 
    Launch the Terminal application in any of the following ways: 
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.) 
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens. 
    ☞ Open LaunchPad. Click Utilities, then Terminal in the icon grid. 
    When you launch Terminal, a text window will open with a line already in it, ending either in a dollar sign (“$”) or a percent sign (“%”). If you get the percent sign, enter “sh” and press return. You should then get a new line ending in a dollar sign. 
    Step 1 
    Triple-click anywhere in the line of text below on this page to select it:
    kextstat -kl | awk '!/com\.apple/{printf "%s %s\n", $6, $7}' | open -ef
    Copy the selected text to the Clipboard by pressing the key combination command-C. Then click anywhere in the Terminal window and paste (command-V). I've tested these instructions only with the Safari web browser. If you use another browser, you may have to press the return key after pasting. A TextEdit window will open with the output of the command. If the command produced no output, the window will be empty. Post the contents of the TextEdit window (not the Terminal window), if any — the text, please, not a screenshot. You can then close the TextEdit window. The title of the window doesn't matter, and you don't need to post that. No typing is involved in this step.
    Step 2 
    Repeat with this line:
    { sudo launchctl list | sed 1d | awk '!/0x|com\.(apple|openssh|vix\.cron)|org\.(amav|apac|cups|isc|ntp|postf|x)/{print $3}'; echo; sudo launchctl getenv DYLD_INSERT_LIBRARIES; echo; sudo defaults read com.apple.loginwindow LoginHook; echo; sudo crontab -l; } 2> /dev/null | open -ef
    This time you'll be prompted for your login password, which you do have to type. Nothing will be displayed when you type it. Type it carefully and then press return. You may get a one-time warning to be careful. Heed that warning, but don't post it. If you see a message that your username "is not in the sudoers file," then you're not logged in as an administrator. 
    Note: If you don’t have a login password, you’ll need to set one before taking this step. If that’s not possible, skip to the next step. 
    Step 3
    { launchctl list | sed 1d | awk '!/0x|com\.apple|org\.(x|openbsd)/{print $3}'; echo; launchctl getenv DYLD_INSERT_LIBRARIES; echo; crontab -l 2> /dev/null; } | open -ef
    Step 4
    ls -A /e*/{cr,la,mach}* {,/}Lib*/{Ad,Compon,Ex,Fram,In,Keyb,La,Mail/Bu,P*P,Priv,Qu,Scripti,Servi,Spo,Sta}* L*/Fonts .la* 2> /dev/null | open -ef
    Important: If you formerly synchronized with a MobileMe account, your me.com email address may appear in the output of the above command. If so, anonymize it before posting. 
    Step 5
    osascript -e 'tell application "System Events" to get name of login items' | open -ef
    Remember, steps 1-5 are all copy-and-paste — no typing, except your password. Also remember to post the output. 
    You can then quit Terminal.

  • Datagram socket and security manager

    I have subclassed the security manager to implement my own network security rules.
    However when the receive(datagramPacket) method is called by the my datagram socket, the host parameter passed to the checkAccept(host, port) method does not belong to the sender of the packet(to be received).
    How then can malicious addresses be blocked by the security manager, as suggested by the comments in the source code of DatagramSocket.
    Any help is greatly appreciated. Thank you in advance.

    However when the receive(datagramPacket) method is
    called by the my datagram socket, the host parameter
    passed to the checkAccept(host, port) method does
    not belong to the sender of the packet(to be
    received).It should. What are you getting instead?

  • Datagram Socket Problem !!!!!!!!!!!!!!!

    Hi to All ,
    I am facing problem regarding the Datagram Socket Programming .
    I wana to make a java program that is using the datagram socket. I wana to retrive the IP Address of all the machines that are connected in a local network by using the datagram Socket !!!!!!!!!!!!!!
    As i am new in java Socket Programming , Can any body help me How am i sends a Broadcast Packet to all the machines that are connected in a local network , so that i retrieve the IP Address of all the machines that are presented in a local network
    Please give the Solution

    You can't use any Java to find all the machines on your network (whatever that means). You will need to shell out and parse the output from the shell.
    If you want to simply use datagram sockets to send UDP broadcasts, the Javadoc covers it in some detail.
    However, UDP is called a "send and pray" protocol - you send the message and pray that the client receives it. Also, there is no acknowledgement from the client when the message is received. So, in a nutshell, you cannot use multicasts to find clients.
    You need to use some other protocols in the TCP/IP stack for finding machines on the network - and Java does not have any pre-built support for these.

  • [SOLVED] MPD isn't making any sound while running as its own user

    I can't make MPD produce any sound when it runs as its own user.
    - I'm running MPD from systemctl
    - If I run MPD as my own user I get sound
    - I am not using pulseaudio
    - mpv, for example, plays sound fine
    - speaker-test -c 2 -D hw:1 plays sound fine
    - journalctl -u mpd gives errors of the following type:
    Jul 26 15:08:25 alexei-desktop mpd[5951]: alsa_output: Failed to open "My ALSA Device" [alsa]: Failed to open ALSA device "default": No such file or directory
    Jul 26 15:08:25 alexei-desktop mpd[5951]: output: Failed to open audio output
    Jul 26 15:08:25 alexei-desktop mpd[5951]: player: problems opening audio device while playing "deep_medi/releases_volume_one/01-Kalawanji.flac"
    /etc/mpd.conf for sound outputs:
    audio_output {
    type "alsa"
    name "My ALSA Device"
    # device "plughw:1" # optional
    # format "44100:16:2" # optional
    # mixer_type "hardware" # optional
    # mixer_device "default" # optional
    # mixer_control "PCM" # optional
    # mixer_index "0" # optional
    My ~/.asoundrc looks like this:
    pcm.!default {
    type plug
    slave.pcm "dmixer"
    pcm.dmixer {
    type dmix
    ipc_key 1024
    slave {
    pcm "hw:0,0"
    period_time 0
    period_size 1024
    buffer_size 4096
    rate 44100
    bindings {
    0 0
    1 1
    ctl.dmixer {
    type hw
    card 0
    > groups mpd
    audio mpd
    > aplay -l
    **** List of PLAYBACK Hardware Devices ****
    card 1: SB [HDA ATI SB], device 0: ALC888 Analog [ALC888 Analog]
    Subdevices: 1/1
    Subdevice #0: subdevice #0
    card 1: SB [HDA ATI SB], device 1: ALC888 Digital [ALC888 Digital]
    Subdevices: 1/1
    Subdevice #0: subdevice #0
    card 2: HDMI [HDA ATI HDMI], device 3: HDMI 0 [HDMI 0]
    Subdevices: 1/1
    Subdevice #0: subdevice #0
    Last edited by PlasmaSheep (2014-08-02 03:45:07)

    Sure, sounds good.
    > aplay -l
    **** List of PLAYBACK Hardware Devices ****
    card 0: CODEC [USB Audio CODEC], device 0: USB Audio [USB Audio]
    Subdevices: 1/1
    Subdevice #0: subdevice #0
    card 1: SB [HDA ATI SB], device 0: ALC888 Analog [ALC888 Analog]
    Subdevices: 1/1
    Subdevice #0: subdevice #0
    card 1: SB [HDA ATI SB], device 1: ALC888 Digital [ALC888 Digital]
    Subdevices: 1/1
    Subdevice #0: subdevice #0
    card 2: HDMI [HDA ATI HDMI], device 3: HDMI 0 [HDMI 0]
    Subdevices: 1/1
    Subdevice #0: subdevice #0
    > lsmod | grep snd
    snd_hda_codec_realtek 54803 1
    snd_hda_codec_generic 56366 1 snd_hda_codec_realtek
    snd_hda_codec_hdmi 40396 1
    snd_usb_audio 131860 2
    snd_usbmidi_lib 21428 1 snd_usb_audio
    snd_rawmidi 20278 1 snd_usbmidi_lib
    snd_hda_intel 22831 2
    snd_seq_device 5244 1 snd_rawmidi
    snd_hda_controller 22911 1 snd_hda_intel
    snd_hda_codec 104665 5 snd_hda_codec_realtek,snd_hda_codec_hdmi,snd_hda_codec_generic,snd_hda_intel,snd_hda_controller
    snd_hwdep 6652 2 snd_usb_audio,snd_hda_codec
    snd_pcm 83207 6 snd_usb_audio,snd_hda_codec_hdmi,snd_hda_codec,snd_hda_intel,snd_hda_controller
    snd_timer 19294 2 snd_pcm
    snd 61276 18 snd_hda_codec_realtek,snd_usb_audio,snd_hwdep,snd_timer,snd_hda_codec_hdmi,snd_pcm,snd_rawmidi,snd_hda_codec_generic,snd_usbmidi_lib,snd_hda_codec,snd_hda_intel,snd_seq_device
    soundcore 5551 2 snd,snd_hda_codec
    usbcore 188381 7 snd_usb_audio,ohci_hcd,ohci_pci,snd_usbmidi_lib,ehci_hcd,ehci_pci,usbhid
    > cat /etc/modprobe.d/alsa-base.conf
    options snd slots=snd_usbaudio,snd_hda_intel
    options snd_hda_intel index=0
    options snd_hda_usbaudio index=1
    I'm not exactly sure what to put in ~/.asoundrc, however...

  • Each exception class in its own file????

    Hi, I am still quite new to java, and I don't fully understand exceptions. Could you please tell me if for each exception class you require do you have to have a a seperate file. e.g. I'm creating my own array exceptions classes.
    The following is the structure:
    ** The base array exceptions class
    public class arrayException extends Exception {
    public arrayException () { super(); }
    public arrayException (String s) { super(s); }
    ** The outofboundsArrayException
    public class outofboundsArrayException extends arrayException {
    public outofboundsArrayException ()
    { super("Number entered is out of bounds"); }
    public outofboundsArrayException (String s)
    { super(s); }
    ** The fullArrayExceptiom
    public class fullArrayException extends arrayException {
    public fullArrayException ()
    { super("The array is full"); }
    public fullArrayException (String s)
    { super(s); }
    So will the three classes above need their own file.
    I wanted to also know what the super does. I thought when the exception was raised, the text message in the super method is outputted, but i've tested that and it doesn't output (e.g. the error message "The array is full" doesn't output). The only thing that outputs is what you put in the catch part.
    Thank You very Much!

    Could you please tell me if
    for each exception class you require do you have to
    have a a seperate file.Yes. Exception classes are like any other public class in Java, in that it must be in its own file with the standard naming conventions.
    I wanted to also know what the super does. I thought
    when the exception was raised, the text message in
    the super method is outputted, but i've tested that
    and it doesn't outputsuper([0,]...[n]) calls a constructor in the superclass of your current class matching the signature super([0,]...[n]). In this particular case, the Exception's message property is being set by the parent constructor. If you were to leave out super([0,]...[n]), the default no-arg constructor of the superclass would be invoked, and the message would not be set.
    Use the getMessage() method of the Exception class to return the message value in later references to your object.

  • Code causing exceptions at its own sweet time and place

    import java.lang.*;
    class newthread implements Runnable
         Thread t;
         int click=0;
         public volatile boolean running=true;
         newthread(int p)
              t=new Thread(this);
              t.setPriority(p);
         void start()
              t.start();
         public void run()
              while(running)
                   click++;
         void start1()
              running=true;
         void stop()
              running=false;     
    class threadpriority2
         public static void main(String argv[])
              newthread ob1=new newthread(Thread.NORM_PRIORITY+2);
              newthread ob2=new newthread(Thread.NORM_PRIORITY-2);
              ob1.start();
              ob2.start();
              try
                   Thread.sleep(5000);
              catch(Exception e)
                   System.out.println("error detected:"+e);
              System.out.println("first one:"+ob1.click);
              System.out.println("first one:"+ob2.click);
              System.out.println("the priority of ob1 is:"+ob1.t.getPriority());
              System.out.println("the priority of ob2 is:"+ob2.t.getPriority());
              ob1.stop();
              ob2.stop();
              ob2.t.setPriority(Thread.NORM_PRIORITY+3);      
              ob1.t.setPriority(Thread.NORM_PRIORITY-3);
              ob1.start1();
              ob2.start1();
              ob1.start();
              ob2.start();
              System.out.println("the priority of ob1 is:"+ob1.t.getPriority());
              System.out.println("the priority of ob2 is:"+ob2.t.getPriority());
              try
                   Thread.sleep(5000);
              catch(Exception e)
                   System.out.println("error detected:"+e);
              ob1.stop();
              ob2.stop();
              System.out.println("first one:"+ob1.click);
              System.out.println("first one:"+ob2.click);
    errors during runtime:
    Exception in thread "main" java.lang.IllegalThreadStateException
    at java.lang.Thread.start(Unknown Source)
    at newthread.start(threadpriority2.java:17)
    at threadpriority2.main(threadpriority2.java:77)
    when i run this code it causes exceptions at its own sweet locations when i run it separately.if once it displays some valid input it would then be followed by the exception
    next time if i run it it will throw exception as soon as i run it at the very start without displaying even an iota of valid data like the previous case
    is ti because the os is placing restrictions on the threads growth or something else.incase there is an error in my code it should atleast pop up the exceptions at one particular loaction in the output and not give different outputs

    1) When you post code, please use and tags as described in Formatting tips on the message entry page. It makes it much easier to read.
    wasnt aware of it.will keep it in mind i post nexttime.sorry for the inconvenience[\b]
    3) You have multiple threads, right? The scheduling of which thread gets how much CPU time when is not subject to your control or prediction, so of course you'll see different timings in subsequent runnings of the same code.[b]actually the problem is not with multiple threads showing different times.whats happening is that exceptions are being thrown randomly at runtime.once when i ran it the exception was displayed at the very beginning of the output and the program snapped.next when i ran it first some output which was slated to be displayed got displayed and then the exceptions appeared in the output.now if the exceptions are thrown at the very beginning its obvious theres some problem at the background coz in the second case that never happened[\b]
    i guess the formatting tips have taken effect[:D]

  • Safari downloading data "on its own"

    Hi,
    Yesterday I connected my iphone to use its 3G network with tethering. I browsed some sites and promptly received an SMS from my carrier, telling me that I had used all of my 500 MB of monthly data.
    Surprised, I checked the "Tethering data" within the iphone settings, and sure enough, I had used about 300 MB in about half an hour of light browsing, which is very strange.
    I started investigating and discovered that, sometimes, Safari starts downloading data while I'm doing nothing. Megabytes and megabytes of data. I don't know the source, and it's only input data, not output. I have checked with Activity Monitor, and closing Safari stops the data transfer. Opening it again resumes data transfer
    Please note that I consider myself an advanced user, so I have googled a lot, checked that the pages aren't downloading any video in the background (in fact I use FlashBlock), etc. Even disabled automatic update for plugins, but no luck.
    I have tried to reproduce the problem and it's kind of difficult because the rogue data downloading from Safari is quite random.
    So, my question is, why is Safari downloading data on its own when I'm doing nothing, which data is it, and how can I stop Safari from doing it. It's eating up my connection and now I have to use Chrome to browse the internet, as Safari kills my 3G data plan.
    Thanks!
    Carlos

    Install the free application "TinkerTool" (not "TinkerTool System"), select the Safari tab, and check the box labeled "Disable storage of preview images for web pages." Quit and relaunch Safari.

  • Help: Send and Receive through Datagram Socket

    I am trying to create a client/server using Datagram Socket (UDP) as communication. I have a Recive and a Send class that implements runnable and are responsible for receiving and sending of message. I have two other classes Server and Client that are utilizing these. Now i can get the receive and send to work fine, but i am having trouble retrieving the message from the receive thread that i created in each of server/client. I've tried inserting a method so the server/client can call on to get the message (Receive.Get_Message()) but unfortunately this isn't working as i wanted. Since my server and clients are not implemented as runnables, i can only issue the command in some serialize fashion. What i really want to do is that whenever the message is receive by the Receive thread, it will immediately be send back to server/client and display right then, independent of what i was doing. (i have a command interface for S/C so it just sits there to wait for command, now what i would like is to have the S/C display the message it gets immediately after it gets it even when it's waiting for user input. since my program is waiting for a command, i really could not use the method describe above to achieve this) Could anyone help me with this?
    Thanks!
    Hung-Hsun Su

    u cant use the observer pattern. or at least i can't figure out how to implement it with sockets.
    you should use threading.
    public void run()
      while(true)
         //keep reading from socket
         InStream output = socket.getInputStream();
         InputStreamReader ir = new InputStreamReader(output)
         BufferedReader reader = new BufferedReader(ir);
         String s = null;
         while(s == null)
           s = reader.readLine();
         //then do whatever you want to the received string "s"
    }

Maybe you are looking for

  • Adobe PDF Converter fails to create PDF

    Hi, This is my first post here. I've searched the forums but have failed to find any posts describing my specific problem. I am trying to print to PDF using the "Adobe PDF Converter" device, but whenever I try to do so I am presented with a window la

  • Subfolders referred in two places!!!

    Hi, It is not suggested to create same content in the subfolder in two separate folders. Requirement: Content of the subfolder maintained in one place, which should be listed under 2 or more Folders. So that any update on the contents of the subfolde

  • Won't accept registration - asks for Trial/Buy still

    I purchased LR online today and when I enter the registration information and serial number I was able to work within LR with no problem. When I close the program and later open it again, I am presented with the Trial/Buy window still and asked to en

  • Deleted songs that have been purchased

    My son accidentally deleted some songs I had already purchased, any way I can retrieve them?

  • Uploads with Leopard

    Hey, I recently installed Leopard on my MacBook that is about a year old. Everything seems to be working fine except for the fact that when I try to install my updates, it tells me that there is not enough storage room for the updates. I don't know i