Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4362: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4364: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4365: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4366: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
anddev.org • View topic - cannot connect to remote server via socket

cannot connect to remote server via socket

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

cannot connect to remote server via socket

Postby bruce » Thu Nov 05, 2009 9:53 am

Hi Guys
My application use socket to connect a remote sever to get data.
In my handset, both Wi-Fi and Mobile network data connection are enabled, by default device will choose using Wi-Fi connection. In this case, all network access can process normally
However, when I turn off Wi-Fi in system setting page and switch back to my application to start a new session for network access(it will use mobile network), I found that socket could not setup( constructor Socket(String hostname, int port) method does not return).
But if I kill the process then restart application, my application can communicate with server via mobile network normally
Any one know what's the reason for this?

In my application, each time I send a request to server, a new Socket object will be created.
public class SocketConnection implements IConnection{

private Socket sock;

/**
* Initialize the socket
*/
public SocketConnection(IConnectionConfig config) throws IOException, SecurityException{
sock = new Socket(config.getHostName(), config.getHostPort());
}

/**
* @see Connection#openInputStream()
*/
public InputStream openInputStream(){

try {
return sock.getInputStream();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}

/**
* @see Connection#openOutputStream()
*/
public OutputStream openOutputStream(){
try {
return sock.getOutputStream();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}

/**
* @see Connection#close()
*/
public void close(){
try {
sock.close();
} catch (IOException e) {
e.printStackTrace();
}

}

}

Many thanks
bruce
Once Poster
Once Poster
 
Posts: 1
Joined: Thu Nov 05, 2009 9:42 am

Top

Postby sunkillen » Fri Nov 06, 2009 6:01 am

Good question! Anybody knows? :D
sunkillen
Freshman
Freshman
 
Posts: 3
Joined: Tue Jun 24, 2008 8:58 am

Top

Return to Networking & Database Problems

Who is online

Users browsing this forum: No registered users and 1 guest