how to connect with a new server

Problems with WiFi, SQLite ,Bluetooth, WiMax, Proxies, etc...

how to connect with a new server

Postby miry » Sun Mar 01, 2009 10:19 am

Hi,

I would like to connect with a private server in order to download some information and see it in a web browser. The problem is when i try to open a new socket. The program doesn´t work and start a while (problem with s = new Socket("130.233.154.182", port);). The code is the next one:

public void onClick(View v) {
// TODO Auto-generated method stub
int port=4558;

//byte [] asBytes = bundle.toByteArray();

Log.i("before Socket","Opening socket to server..");
Socket s = null;
TCPCLThread aThread = null;
try {
s = new Socket("130.233.154.182", port);

} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Log.i("after new socket","Socket opened");

try {
aThread = new TCPCLThread("dtn://my.fake2.dtn",s.getInputStream(), s.getOutputStream());
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

BundleSenderTest test = new BundleSenderTest(aThread);
aThread.addListener(test);
BundleDumper bd = new BundleDumper();
aThread.addListener(bd);

Log.i("addListener","Started thread, added listener");


Thread t = new Thread(aThread);
t.start();

initWebView(Mywebview, Main.this);


}

};

* I have addes Internet permissions in the manifext xml.

* I have redirected the localhost because i need to pass all the traffic in the port server, using:

telnet localhost 5554
redir add tcp:4558:4558

*Finally i thought that i should use a new DNS server in order to obtaing the correct traffic. In that case i have started the emulator with http-proxy option.

emulator -http-proxy 130.233.154.182:4558

What i am doing wrong? is there anything i am forgeting?

Thanks in advance
miry
Freshman
Freshman
 
Posts: 5
Joined: Sun Mar 01, 2009 10:00 am

Top

Postby MrSnowflake » Mon Mar 02, 2009 9:41 am

You might wanna find out what the error is...
User avatar
MrSnowflake
Moderator
Moderator
 
Posts: 1439
Joined: Sat Feb 16, 2008 3:11 pm
Location: Flanders, Belgium

Postby miry » Mon Mar 02, 2009 10:36 am

MrSnowflake wrote:I have tried to understand what kind of error i have, but that is my problem, i think that is correct but it doesn,t work. Do you have any idea?

Thank you
miry
Freshman
Freshman
 
Posts: 5
Joined: Sun Mar 01, 2009 10:00 am

Postby MrSnowflake » Mon Mar 02, 2009 11:06 am

Did you check your log?
User avatar
MrSnowflake
Moderator
Moderator
 
Posts: 1439
Joined: Sat Feb 16, 2008 3:11 pm
Location: Flanders, Belgium

Postby miry » Mon Mar 02, 2009 11:56 am

MrSnowflake wrote:Did you check your log?


Yes, The last log is log.i("before Socket","Opening socket to server.."), after that the program is blocked trying to open the new socket. I was debugging but when i tried to pass the socket sentence the connection is refused and the program is blocked.
miry
Freshman
Freshman
 
Posts: 5
Joined: Sun Mar 01, 2009 10:00 am

Postby Emmanuel7 » Mon Mar 02, 2009 2:09 pm

Do you really have to use a socket for your connection ?
If all you want is a web connection, there are more high level component (like httpconnection object ).

But I'm not sure it fits your needs ( what is the dtn: protocol, by the way ??? )
Emmanuel7
Senior Developer
Senior Developer
 
Posts: 164
Joined: Fri Dec 12, 2008 2:17 am
Location: Paris

Top

Postby miry » Mon Mar 02, 2009 2:19 pm

Emmanuel7 wrote:Do you really have to use a socket for your connection ?
If all you want is a web connection, there are more high level component (like httpconnection object ).

But I'm not sure it fits your needs ( what is the dtn: protocol, by the way ??? )


I can not use httpconnection because i have programed another kind of protocol for delay tolerant networking. This program is effectives if google android is not used, just a normal java application. In order to see the information in the DTN server (information exchange)i have to open a new socket connection with the above parameters but can not solve it.

How can i configure the setting in the emulator? Do i need a proxy? I don't know how can i do that.
miry
Freshman
Freshman
 
Posts: 5
Joined: Sun Mar 01, 2009 10:00 am

Top

Return to Networking & Database Problems

Who is online

Users browsing this forum: No registered users and 2 guests