NIO problems, no answer from aljazeera

I'm sending a HTTP request (shown below) to www.aljazeera.net
GET /NR/EXERES/0065325B-D83C-43BB-8B1A-DD15E0A05608.htm HTTP/1.1
Host: www.aljazeera.net
and it hangs indefinitely.
The exact same code works for a bbc news site, returning me the webpage I want. My code is posted below, thanks in advance for your advice. This code is the run method of a thread which has "link" set to " www.aljazeera.net/NR/EXERES/0065325B-D83C-43BB-8B1A-DD15E0A05608.htm" when this code is run.
try
               SocketChannel sChannel = SocketChannel.open();
             sChannel.configureBlocking(false);
             URL url = new URL(link);
            // System.out.println(url.toString() + " is the link");     
             sChannel.connect(new InetSocketAddress(url.getHost(), 80));
             while (!sChannel.finishConnect()) {
                  if(this.interrupted())
                       return;
             ByteBuffer buf = ByteBuffer.allocateDirect(1024);
             CharBuffer cBuf = CharBuffer.allocate(1024);
             //System.out.println("request " + url.getQuery());
             String s = "GET "+ url.getPath() + " HTTP/1.1\r\n";
             s += "Host: " + url.getHost() + "\r\n\r\n";
             System.out.println(s);
             Charset charset = Charset.defaultCharset();
             CharsetEncoder encoder = charset.newEncoder();
             CharsetDecoder decoder = charset.newDecoder();               
             sChannel.write(encoder.encode(CharBuffer.wrap(s)));
             String resp = "";
             while (sChannel.read(buf) != -1) {
                  if(this.interrupted())
                      return;
                  buf.flip();
                  decoder.decode(buf,cBuf,false);
                  cBuf.flip();
                  resp += cBuf;
                  buf.clear();
                  cBuf.clear();
             System.out.println(resp);
             sChannel.close();
          catch(Exception e)
                        e.printStackTrace();
               System.exit(0);
}

          sChannel.configureBlocking(false);
             while (!sChannel.finishConnect()) {
                  if(this.interrupted())
                       return;
             }   Why not just connect in blocking mode with a timeout?
             sChannel.write(encoder.encode(CharBuffer.wrap(s)));Here you are ignoring the write-count returned by the write() method. You have no assurance that anything got written at all, let alone the complete request string.

Similar Messages

  • Big Fish Games stop working in Mavericks.  What do I do? I have re-installed them and the manager app, and nothing.  I have not gotten an answer from Big Fish tech staff.  Thought the problem might be with Maverick.  all the games worked with Snow Leopard

    Big Fish Games stop working in Mavericks.  What do I do? I have re-installed them and the manager app, and nothing.  I have not gotten an answer from Big Fish tech staff.  Thought the problem might be with Maverick.  all the games worked with Snow Leopard
    Any body have this kind of problem.  What was done to correct it. . .

    I can't wait to get a new phone as well. LG Revolution owners should be comped for this phone if Verizon intends to keep them as customers.

  • Can't download book. Get the following message. "Error getting license server communication problem MW_ADEPT_CORE_EXPIRED" I have no faith in this type of communication because I have never recieved answers from forums/ wish you could afford a live person

    can't download book. Get the following message. "Error getting license server communication problem MW_ADEPT_CORE_EXPIRED" I have no faith in this type of communication because I have never recieved answers from forums/ wish you could afford a live person

    I select a book to read from my library it takes me to digital editions and this message comes up. Has been working for a couple of years but something has happened, maybe I did it but don't and to make it worse there is no one to contact to fix it. Get the following message. "Error getting license server communication problem MW_ADEPT_CORE_EXPIRED" I

  • I download a rental movie and don't want to finish the downloading  but I Use the report a problem link in your account history...but i didn't get any answer from Apple

    I download a rental movie and don't want to finish the downloading  but I Use the report a problem link in your account history...but i didn't get any answer from Apple

    The posted did what this said:
    How to report an issue with Your iTunes Store purchase
    The link includes the statement:
    "The iTunes Store's Customer Support team will contact you as soon as possible, typically within 24 hours."
    Applelover1 wrote:
    Usually Apple won't respond, instead they will just fix the problem you have suggested if it is a problem that persists in other user's computers. What problem did you report? Did you ask for them to respond?

  • I see lots of people asking questions about the "white screen" app store update failure. I see no answers from Apple about this...What is the problem, and what is the solution?

    I see lots of people asking questions about the "white screen" app store update failure. I see no answers from Apple about this...What is the problem, and what is the solution?

    It's a problem that Apple is having with their App updating system.  The best solution is to be patient, and wait for Apple to solve their systemic problem.

  • NIO Problem

    I had a NIO problem.
    I tried to open a socket channel, and grep a HTML page from HTTP GET.
    I did it success if I open and close socket channel everytime I send a
    request and get the response.
    However, if I keep open the socket channel and send multiple requests,
    I'll get IOException.
    Does anybody know how to solve this problem? Thanks in advance!
    Note: I don't want to fire requests in parallel but one by one
    sample code:
    =============================================================
    private Charset charset = Charset.forName("ISO-8859-1");
    private SocketChannel channel;
    try
    // do connection
    InetSocketAddress socketAddress =
    new InetSocketAddress( "www.mydomain.com", 80);
    channel = SocketChannel.open(socketAddress);
    // send request #1
    channel.write(charset.encode("GET /page1.html HTTP/1.0\r\n\r\n") );
    // read response #1
    ByteBuffer buffer = ByteBuffer.allocate(1024);
    while ((channel.read(buffer)) != -1)
    buffer.flip();
    System.out.println(charset.decode(buffer));
    buffer.clear();
    // send request #2
    channel.write(charset.encode("GET /page2.html HTTP/1.0\r\n\r\n") );
    // read response #2
    // program threw "java.io.IOException: Read failed" error
    while ((channel.read(buffer)) != -1)
    buffer.flip();
    System.out.println(charset.decode(buffer));
    buffer.clear();
    catch (IOException e)
    e.printStackTrace();
    finally
    if (channel != null)
    try
    channel.close();
    } catch (IOException e) {}
    =============================================================

    I am pretty sure that most webservers only do one request per connection by default. Try looking up some information on HTTP request headers. I am pretty sure there is a header that you need to send to the server to let the server know that you want to do multiple requests with the same connection. I believe the header is called 'keep alive' or some other such thing.
    I'm not an expert on http, so I can't help you any further that that.

  • Problem in connection from SAP to XI

    Hi Guys,
    I have problem to connect from SAP to XI.  We have existing SAP R/3 (IS-H) and we newly installed XI. We decided to use ABAP proxy to send data from SAP to XI. When I go to SPROXY system showing ‘No Connection to Integration Builder’. Please kindly advice what configuration we need to in SAP side in order to connect XI.
    It’s Very Urgent. Please advice me.
    Thanks in Advance.
    Regards,
    Anil.

    Anil,
    could you please have a look to SAP Note 689847 - XI 3.0: SPROXY - No connection to the Integration Builder
    Cheers,
    -Sunil

  • Hi I am having problems removing mail from trash folder. Can anyone help please

    Hi I am having problems removing mail from trash folder. I can send mails to the folder but cannot delete them permanently from the trash folder. I am using Iphone 3G and anm up to date with OS. Can anyone help please

    Check that there isn't a different Trash folder to the one with the proper Trash symbol on it.
    If you see one in your list of folders rather than a separate one, highlight it, then click on Mailbox...Use this mailbox for...Trash

  • Problem emailing photos from iPhoto after installing OS 10.5.1

    Since installing Leopard I have had problems emailing photos from iPhoto. I can send from my laptop to another Mac without problem BUT when I try to email pix from iPhoto to a PC user or to post on my Google Group board it only sends the 'title' I gave it in iPhoto or the 'PC134567.JPG' the camera assigns it. I have tried exporting and attaching to emails but that doesnt work either .. at least not all the time. AND when I do send them from iPhoto to my office PC they arrive NOT as an attachment but are embedded in the email message .. seriously what the heck is going on and why is this not working the way it used to pre-OS 10.5.1? What changed? How can I make this work the way it used to?
    Thanks for reading and hopefully solving my problem

    Thank you again .. I got home and immediately tried the fix you suggested .. sent a 'test' email and it worked perfectly.

  • "evdre encountered a problem retrieving data from the webserver"

    Hi
    We are using a big report which takes very long time to expand and sometimes we get the error message "evdre encountered a problem retrieving data from the webserver" when expanding the report, but not very often for most of our users. But we have one user who gets this error message almost every second time he expands the report. This user have a computer with same capacity as the rest of us, can there be some setting on the computer or in the client installtion the cause this problem?
    We are using BPC 5.1 SP 5
    /Fredrik

    Hi,
    This error occurs usually if we have huge data in combination of our dimensions.
    Even, if the selection of your memberset is not apt to the combination of the data present in the back end, you may encounter a data retrival error.
    regards
    sashank

  • Problem connecting wirelessly from iMac to NETGEAR router, get invalid password message with WPA and WPA-2 encryption in place but if I remove them, so no security, can connect without a problem. Help!!

    Problem connecting wirelessly from iMac to NETGEAR router, get invalid password message with WPA and WPA-2 encryption in place but if I remove them, so no security, can connect without a problem. Help!!

    Thank you for your suggestion but I have already had a couple of phone sessions with NETGEAR support and they don't see any problems with the router settings etc. They referred me to Apple support, who helped me discover that it is possible to communicate with the router but only if I turn off the encryption/security software, which I don't want to do. The frustrating thing is that I can connect wirelessly from a laptop running Windows 7 and two Anroid smart phones, with WPA-2 in place, without a problem. Do you have any other ideas?

  • Problem launching Campaign from UI

    Hi All
    We have a problem launching campaign from UI screen,as when we try and launch the campaign from the screen
    following error is coming:
    Cannot display view BSPWD_BASICS/WorkAreaHostViewSet of UI Component CRM_UI_FRAME
    An exception has occurred Exception Class CX_SHM_OUT_OF_MEMORY - Insufficient Shared Objects Memory Available
    Method: CL_SHM_AREA=>_ATTACH_WRITE70
    Source Text Row: 2
    Error occurred during navigation
    An exception has occurred Exception Class CX_BSP_WD_RUNTIME_ERROR -
    Method: CL_BSP_WD_VIEW_CONTROLLER=>BIND_VIEW
    Source Text Row: 165
    Cannot display view BSPWD_BASICS/BreadCrumbView of UI Component CRM_UI_FRAME
    An exception has occurred Exception Class CX_BSP_WD_INV_VA_ASSIGNMENT - Assigned view in view area Root could not be loaded.
    Method: CL_BSP_WD_HIST_MANAGER_BASE=>GET_VIEW_ASSEMBLY
    Please suggest what should i do to correct this(we are working on CRM 2007)
    Any help will be highly appreciated
    Regards
    Ashish

    Hi,
    Would you please show your solutions? I am facing the same problem. Thanks!
    BR,
    Hao

  • Windows 8.1 account limit problem when downloading from store

    windows 8.1 account limit problem when downloading from store        
    I have 250 windows 8.1 tablets.
    I figured since you can use the same account on 81 devices id create 4 accounts.
    I need to download more than 25 free apps from the store
    on each tablet. Putting the same account don't work. (comes up with an error after putting on to many devices that you cant use this account now).
    Whats the best way to do this ? and what if I need to download a paid app ?
    Thank You.

    Hi,
    As far as I know, One Microsoft Account may bound at most five Trusted computers. There is no way to break this limitation.
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact [email protected]

  • Problems importing connections from a SAN directory

    Is anybody having a problem importing connections from a directory that's on a SAN?
    My network is setup so that the Application Data directory is out on a SAN and when SQL Developer opens up the file dialog, current directory is listed as C:\ and entry in the file name field is file://<server>/<path to my stuff>/Application Data/SQL Developer/. This looks fine but when I click on the "Open" button to get the directory listing, an error dialog pops up with the following message:
    The directory C:\file:\<server>\<path to my stuff>\Application Data\SQL Developer is not accessible. Please select a different directory.
    When I change the current directory to the drive that maps the SAN location, I get the same message only with C: replaced with another drive letter.
    If I had to guess, the dialog is not processing the file:// protocol indicator properly before it attempts to get the directory listing. Does anyone have a work around?

    Other users also had problems with network shares, so you're right that might very well be the cause of your problems.
    As workaround, try mapping the settings folder to a local drive. Add this to \sqldeveloper\bin\sqldeveloper.conf:
    AddVMOption -Dide.user.dir=C:\sqldeveloperHope that helps,
    K.

  • I have problems transferring files from PC to Mac and from Mac to Mac

    I have problems transferring files from PC to Mac, and from Mac to Mac.  PC to PC is fine.  Nothing but problems with the Mac.  One example:
    While working on my PC, I open shared folders on an external HDD connected to the Mac.  I click on paste to move the files.  I get an error after a few seconds to a minute of trying to move several files from my PC Win 7 to Mac OS Maverick, that there is a file already at the destination on Mac. This statement is true, but it was just put there because I am copying them over in that same action.  It reads 0Kb and wasn't there before I started.  Then I get an error: The Action Cannot be completed because the folder is open in another program.  Close the folder or file and try again..
    Whether I click on it a bunch right of way or wait, it still takes about 45 seconds. I have to do it with every file and it only happens when copying from a PC to Mac.  I have even restarted both computers so nothing is using any files.  If I copy one file at a time, I don't get any error.
    So I have one file to move, no problem.  If move 5 files, The first will go fine, but it shows all 5 files in folder at once.  All other files than the first show 0kb. I get the file already existing error once it starts the second file transfer, and I select move and replace.  Then I get The Action Cannot be completed because the folder is open in another program.  I wait or click repeatedly until it starts to move file.  That file will then show something other than 0kb.  When it is done, the error process starts all over.  I tried checking the PC with unlocker, but the files do not show themselves locked on the PC.

    Its not only French. Even certain characters in English will come across as gobblydegook from 1 platform to another. I see this in emails that likely were composed in Word & the characters don't come across.
    Not sure if this is still true, but years ago someone explained that there is a standard character set & then I think its extended characters & those vary from platform to platform or language to language, etc.

Maybe you are looking for

  • Reformatting Macbook Pro

    Hi there, am a newbie here, I searched the other threads here but didn't come across an answer that deals with my specific problem...I recently bought a new MacBookPro and used migration assistant to retrieve files etc from my old MacBook. This went

  • What do I do with my printer??

    I have a five-year-old OKI color printer (C3400n) which I just found out from OKI tech support is incompatible with Lion.  Apparently, Lion only uses a program language which my older printer cannot read, so a driver cannot be developed.  Snow Leopar

  • Searching for special symbols

    Is there any way of searching, in Reader XI (using Windows XP, for example), for special characters such as u-unlaut, e-acute, or the math'Scientific symbol 6,29 (a small black upward-pointing triangle)?

  • ITunes fetching default album art from installed iOS app

    Hello, Whenever I import an MP3 file (by dragging it from Finder) with -no- embeded artwork into iTunes I'd expect this to be added with the default double quaver album artwork. However the default artwork is instead taken from an iPad/iPhone app fro

  • Ipod touch did not upgrade to ios5. Why?

    iTunes was upgraded to version 10.5 on my personal computer.  I connected my iPod touch 3rd generation to it in order to upgrade it to ios5. My iPod indicated a sync was in progress but after 3 hours, it still had not completed the download. Can anyo