Unable to send .mp3 with sockets, help!

I need to send my .mp3 files throw a server but it stays in stuck in out.write(lenght), any suggestions for another type of way to do this...
Other files are sent fine, .pdf, .txt, .doc... i might be the size but how to solve it...
try {
            Socket socket=null;                 
            socket = new Socket(GlobalValues.ipOut, GlobalValues.portOut);
            OutputStream out = socket.getOutputStream();     
            InputStream fis = new FileInputStream(f);
            int length=0;
            BufferedInputStream buf = new BufferedInputStream(fis);
            //byte[] buffer = new byte[9*9*1024];
            GlobalValues.creatTextArea("                 Uploading PLEASE WAIT...", 1, Color.red, 0); 
            while((length = buf.read()) != -1){
                out.write(length);
                out.flush();
            GlobalValues.creatTextArea("                  FINISHED upload", 1, Color.green, 0);             
            fis.close();
            out.close();
        catch(Exception e){
            e.printStackTrace();
        }

OutputStream out = socket.getOutputStream();     OutputStream out = new BufferedOutputStream(socket.getOutputStream());
int length=0;This is not a correct name for this variable. You are reading bytes from the input stream, not lengths. A better name would be 'data'.
while((length = buf.read()) != -1){
out.write(length);
out.flush();Move this flush to after the loop.
If you're blocking in the write() it means the reader is slow reading. Using the BufferedOutputStream may fix this.

Similar Messages

  • Unable to send mp3 with mail attachment. Zip the file doesn't work same

    Tried to send an mp3 file several times and kept getting this message. The file was only 11 mg.
    Unable to send with mail attachment.
    Your message couldn't be sent because a server error occurred. To send this message,please delete the current attachment,then re-attach.
    iMac, Mac OS X (10.7.2)
    Toad replyed try zip file (compress) I did and still got the same message

    Many mail servers cap their message sending or receiving at 4MB.  If you are sending your own work that you want distributed by someone else, check with your internet provider if they can temporarily raise that restriction and the recipient's mail server can temporarily raise those restrictions.   Better would be for both of you to be able to access a webhosting site to share the material and use some FTP programs to send the file to each other.    If it is an MPEG-3 of a commercial CD's music, we can't help you as such distribution is illegal.

  • Protocol layer was unable to send a message - PLEASE HELP !!!!

    I have the Z10 and I am unale to reply to, or forward any e-mails that I receive on my corporate e-mail address.
    I can create and send new e-mails and I am receiving all my e-mails, but I can not forward or reply which is a basic requirement.
    Every time I try I get a message advising that
    "Protocol layer was unable to send a message"
    Please HELP!!!!!
    Antony.....

    Hi and Welcome to the Community!
    There are several public KB articles that deal with that error, depending on your exact circumstances. I suggest you go here:
    http://btsc.webapps.blackberry.com/btsc/microsites/microsite.do
    Search on your exact error message, then inspect the articles that result from the search to see which apply to your specific situation.
    Good luck!
    Occam's Razor nearly always applies when troubleshooting technology issues!
    If anyone has been helpful to you, please show your appreciation by clicking the button inside of their post. Please click here and read, along with the threads to which it links, for helpful information to guide you as you proceed. I always recommend that you treat your BlackBerry like any other computing device, including using a regular backup schedule...click here for an article with instructions.
    Join our BBM Channels
    BSCF General Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • Unable to send email with an attachement (photo) through activesync (zarafa) after upgrading to ios8

    Hello,
    I just upgrading to ios 8 (8.0.2) and I am now unable to send email with an attachement (photo) through activesync (zarafa).
    It works fine with smtp or through activesync but without attachement.
    Is there any solution?
    Thx.

    It worked fine with the last version of iOS 7 and still works fine with outlook connected from a PC to the same activesync server.

  • Getting: Unable to send attachment with Mail Drop

    Mail Drop is not working for me, I always get error message while trying to send.
    Here is what happens:
    -I compose a message that includes a large attachment
    -I click send
    -I get the message "Unable to send attachment with Mail Drop" for a few seconds
    -My message is not sent and it goes into the Outbox folder.
    Configuration:
    OS X 10.10 Yosemite
    Mail -> Preferences -> Accounts -> Advanced. The option "Send large attachments with Mail Drop" is selected.

    I had the exact same problem.  I finally figured out what was wrong.  I believe you must have iCloud Drive turned on in System Preferences AND you also must allow mail to store document in iCloud Drive which you can check by clicking the "Options..." button in the preference pane of iCloud Drive. As you can see below.

  • Office 365 unable to send mail with automatic address

    hi,
    I am unable to send email from outlook 2013 (configured to office 365 exchange) it appears a message as "sorry something went wrong. you may want to try again"
    I have configured a old pst file along with same outlook.. 
    it can send easly with typing manually email address .
    please provide me the solution..
    regards
    [email protected]

    Hi,
    Please first try to log into your OWA and check if you can send email using autocomplete address. If OWA works fine, it means the problem is specific to Outlook client.
    If this issue only happen with single or several addresses, we can just delete the address by clicking 'X' after the address:
    If this issue happen to all autocomplete addresses, there may be a problem with your autocomplete cache. We can rename the cache file to resolve the problem. You can refer to the following KB article for detailed steps:
    http://support.microsoft.com/kb/2682333/en-us
    Hope this helps.
    Regards,
    Steve Fan
    TechNet Community Support

  • HT5622 Unable to send and receive iMessages, help!

    For some reason, I am suddenly unable to send and receive Imesages? Iv rang Vodafone customer services, who were no,help at all.
    Iv tried lots of suggestions on the internet, but no luck!
    Any help would be appreciated
    Thanks

    Hello, Theresa132. 
    Thank you for the question.  The article below will help you troubleshoot your issue with iMessage.
    iOS: Troubleshooting Messages
    http://support.apple.com/kb/ts2755
    Cheers,
    Jason H.

  • Unable to send emails with exchange

    I have set uip exchange on my Iphone5, I can receive emails but not send them, it says "recipient r4ejected by server" I have tried this with several email addresses. Should I set the exchange account up as an Imap, if I do it wont sync

    Hi there n2tck!
    I have an article for you that can help you troubleshoot this issue with your email account on your iPhone. The article can be found right here:
    iOS: Unable to send or receive email
    http://support.apple.com/kb/TS3899
    Specifically, you may want to try the last step:
    Delete the account from Settings > Mail, Contacts, Calendars and then add the email account again on the iOS device.
    If that doesn't do the trick, you might want to follow the advice at the end of the article:
    If you're still unable to send or receive email, contact your email provider and verify the account settings are correct. You will need to gather this information (PDF).
    Hope that helps. Thanks for using the Apple Support Communities!
    Regards,
    Braden

  • Unable to send attachments with e mails.

    Unable to attach anything to e mails before sending them. I closed down computer once and saved e mails to draft and tried again and it worked. However it is now impossible to send attachment with e mails. When you click attach the my documents folder does not open up? I am using Windows 10 software and O/S Windows XP home edition.

    Mp3 file will always attach. When I hit send..the sending message will activate..then the e-mail will just sit there with the little spinning dots and say sending for as long as 10minutes or more and eventuall it will stop trying to send and have some kind of error message saying 'We encountered a problem'. This has been going on for over 2 years and several 'FireFOX' upgrades.
    I switch over to Safari and use the same -email' and bingo..it sends in a few seconds.

  • N70 Unable to send Text msg - Please help

    I have just got an N70 complete with pc suite 6.7. I have used it twice to send text msgs last week and today have come to use it and it says unable to send txt msg. I have read through all other threads and have found that even though it says this it still sends (unbeknown at the time so i clicked it about 10 times!!!!)
    I am not a very technical computer person so if anyone can help in VERY SIMPLE computer lingo it would be much appreciated. Thanks.

    All I can think is that the message centre number is somehow wrong... but it shouldn't be, as far as I'm aware, the PC Suite puts the outgoing SMS in your outbox and the phone deals with it from there on...
    Stuck :s
    Nokia History: 3110, 5110, 7110, 7110, 3510i, 6210, 6310i, 5210, 6100, 6610, 7250, 7250i, 6650, 6230, 6230i, 6260, N70, N70, 5300, N95, N95, E71, E72
    Android History: HTC Desire, SE Xperia Arc, HTC Sensation, Sensation XE, One X+, Google Nexus 5

  • Unable to send pictures with mail from iPhoto

    Since yesterday i cannot use iPhoto to send pictures with mail, it just does not open a new mesage in mail. can you help me please? have done cleaning tasks and repeired permissions already. thank you.

    Does anything happen?
    Have you deleted the iPhoto Preference file - A good general step for strange issues is to renew the iPhoto preference file - quit iPhoto and go to "your user name" ==> library ==> preferences ==> com.apple.iPhoto.plist and trash it - launch iPhoto which creates a fresh new default preference file and reset any personal preferences you have changed and if you have moved the iPhoto library repoint to it. This may help
    LN

  • TS3276 I'M unable to send mail with yahoo and gmail accounts. any clues why? any help?

    Need help with MacPro mail and sending email currently not functioning.

    Troubleshooting sending and receiving email messages
    Troubleshooting sending email messages

  • Unable To Send Videos With My DROID RAZR-Please Help

    Why can't I send videos I've taken with my DROID RAZR in a text message?

    Yes I've tried email & that works fine.  I may have the settings for the video wrong & maybe it's too big I don't know.  All I do know is when I try to add a video as an attachment to my message it tells me the I can't add the video to my message & other times it does tell me the video is too large but when I try to resize the video it does not seem to work.  I don't know...I'm confused with this phone.  I love the phone but this is the only problem I have...any advice is appreciated.

  • Multithread program with socket, help me

    Hi all, I have had some troubles with my multithread program, that is when I make 4 threads to send messages to 4 accepted ports: 2001, 2002, 2003 and 2004, it leads to the error:
    "Java.net.SocketException: Software caused connection abort: recv fail"
    I cannot understand why this exception is inconsistent. Please help me figure out
    solution for this problem. Thank you.
    Here is my code
    public synchronized void sendREQMessage(Message obj)
         for(int i=2001;i<=2004;i++)
              try
                             obj.setPortDest(i);
                             myThread thread=new myThread(obj,i);
                   catch (Exception e)
                        System.out.println(e);
    public myThread(Message obj,int i)
              message=obj;
              port=i;
              start();
         public void run()
              try
                   message.setPortDest(port);
                   connection = new Socket("127.0.0.1",port);
                   out = new ObjectOutputStream(
         connection.getOutputStream());               
                   out.writeObject(message);
                   out.flush();
                   //connection.close();
              catch(Exception e)
                   System.out.println(e);
         }

    I'm sorry, I cannot understand what you mean.
    Sometimes, the message can be sent well among 4 ports. Sometimes, it leads to the error:
    "Java.net.SocketException: Software caused connection abort: recv fail"
    And I don't know why.
    Thank for your help

  • Sending objects with sockets (and making a mess thereof)

    I'm playing about with client/server interaction and have made a simple program where a server waits for a connection on its given port, accepts a socket connection and every second checks for any input from the client and sends a Point object with co-ordinates to the client
    The client in renders the Point object and every second checks for an updated Point from the server, whenever the left or right arrow keys are used the server is sent the keyevent object to process and change the co-ordinates of the point which will then be sent back
    But it doesn't work, the server thread hangs on the if statement testing for a new object to read. If the code looking for a new object is comented out, the system works perfectly (with the random co-ordinates shown, the Point object itself is held in another class and would be used if the server could read the input)
              try
                   ObjectOutputStream out = new ObjectOutputStream(socket.getOutputStream());
                       ObjectInputStream in = new ObjectInputStream(socket.getInputStream());
                       boolean temp = true;
                       while (temp == true)
                        sleep(1000);
                        Object o = in.readObject();
                        if (in.readObject() != null)
                             parent.process.updatePoint((KeyEvent)in.readObject());
                        out.writeObject(new Point((int)(Math.random() * 200), (int)(Math.random() * 200)));
              } Could anyone advise me why it specifically doesn't work? Having said that I realise my design is probably rather inefficient and generally poor and any general tips are welcome to
    Any help appreciated

    I think we are going to need to see the other side of your program. If your code hangs at the if statement:
                        if (in.readObject() != null)
                             parent.process.updatePoint((KeyEvent)in.readObject());
                        }Then i would have to assume the object is never recieved.

Maybe you are looking for

  • Is there a way to block access to programs?

    I want to block access to a program called Acquisition, as it's nothing more than a database for ***********. However, I can't seem to find any kind of program that will allow me to block and password protect access to the program. Does anyone know o

  • Error code:-1967362023(0x8abc 7019)

    Hi everyone, When I run the VILogger software using a NIPCI6221 and a CB-68LPR terminal block appears the following error: Engine Error! Error code = -1967362023(0x8abc 7019) Description=Error -19637362023 ocurred at an unidentified location. Possibl

  • Create Query

    Hi frnds I have to create a query in SAP. But in my requirement i am having four flag fields in a table, i need to have a query which should pull records only when any of the flag is 'yes'. How can i do? Please let me know?

  • Nigpib-0.8​.2 wont compile with RH-7.2 kernel-2.4​.18-17.7.x

    nigpib-0.8.2 wont compile with RH-7.2 kernel-2.4.18-17.7.x

  • My cloud invisible dans la zone cible de sauvegarde de smartware

    Bonjour, Configuration :Pc : Asus UV32VXOs : 8.1F.A.I : FreeBox : RévolutionWD : My cloud 2T ( ip fixe )Smartware Pro 2.4.11Micrologiciel à jour Je ne peux synchroniser mes fichiers pc vers my cloud avec smartware. Le disque my cloud n'apparait pas d