DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   Java (http://www.daniweb.com/forums/forum9.html)
-   -   Problem with remote applications interaction using URL (http://www.daniweb.com/forums/thread157723.html)

dickersonka Nov 17th, 2008 5:38 pm
Re: Problem with remote applications interaction using URL
 
sorry don't have time to debug it right now,
are you getting an ioexception in the server from the first trycatch?

dickersonka Nov 17th, 2008 5:39 pm
Re: Problem with remote applications interaction using URL
 
sorry to bombard you with links, but here is another server example

http://fragments.turtlemeat.com/javawebserver.php

Antenka Nov 17th, 2008 5:46 pm
Re: Problem with remote applications interaction using URL
 
Thanks I'll try...

dickersonka Nov 17th, 2008 7:57 pm
Re: Problem with remote applications interaction using URL
 
and also just to make sure you aren't running client and server on the same machine are you?

jasimp Nov 17th, 2008 8:27 pm
Re: Problem with remote applications interaction using URL
 
Quote:

Originally Posted by dickersonka (Post 738224)
and also just to make sure you aren't running client and server on the same machine are you?

I have never had trouble running a server and client on the same machine before, but I haven't looked through the code here to see if they are doing anything different than I usually do. However in an earlier post the OP posted
Quote:

Originally Posted by Antenka (Post 738111)
it reads information:
"
POST / HTTP/1.1
Connection: close
Keep-Alive: 300
User-Agent: Java/1.6.0_07
Host: localhost:2604
Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
Content-type: application/x-www-form-urlencoded
Content-Length: 38

Looking at where it says Host: localhost:2604 led me to believe it is being run on the same machine.

dickersonka Nov 17th, 2008 8:36 pm
Re: Problem with remote applications interaction using URL
 
ah hah, forgot to look at the previous post, i've had some trouble, normally not, but sometimes yes, just want to try and eliminate all possibilities

Antenka Nov 18th, 2008 4:27 pm
Re: Problem with remote applications interaction using URL
 
Oh ... it never ends :( Thanks a lot for spending time working with me and my problem. I have tried new variant - same trouble. I found the way to pass through this problem:
I add "\n\n" in the end of request and then when reading from stream I'm checking, if the string ends on "\n\n" i break the cycle.
Here is updated server code (reading part):
while (true)
            {
                int b = is.read();
                if (b == -1)
                    break;
                request += (char)b;
                if(request.endsWith("\n\n"))
                    break;
            }
It is workibg!
Just interesting, what is wrong? Have any ideas what is that? :)

P.S. about client and server on same machine: this is 3rd home work. Previous 2 also used interacting remote and I tested them on my machine and all works normally.

dickersonka Nov 18th, 2008 4:31 pm
Re: Problem with remote applications interaction using URL
 
lol it is working and you are asking what is wrong?

what part doesn't work? or you mean why it didn't work before?

Antenka Nov 18th, 2008 4:41 pm
Re: Problem with remote applications interaction using URL
 
Yeah ... I mean before. I've posted code for case, if someone be interested.

dickersonka Nov 18th, 2008 4:55 pm
Re: Problem with remote applications interaction using URL
 
i believe its because you have to "tell" the server when you are done sending, since you want the server to send the request back you have to say i'm done, now send the information


All times are GMT -4. The time now is 8:46 am.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC