Yes, I realized that after the last post. Revising the test to
replace the lh= ... line by
lh = InetAddress.getByName("localhost");
produced an immediate connection.
Sorry for the thrashing,
Many thanks,
Ken Bowen
On Apr 10, 9:44 am, Digit <[EMAIL PROTECTED]> wrote:
> it's because "localhost" is resolved to several addresses, i.e. "::1" is the
> IPv6 equivalent of 127.0.0.1
> the emulator only listens on 127.0.0.1 (IPv4-only address).
>
> try "telnet 127.0.0.1 5554" instead then
>
> On Thu, Apr 10, 2008 at 3:24 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]>
> wrote:
>
>
>
> > Well, ok, some slightly odd behavior (should have checked this first):
>
> > $ telnet localhost 5554
> > Trying ::1...
> > telnet: connect to address ::1: Connection refused
> > Trying ::1...
> > telnet: connect to address ::1: Connection refused
> > Trying 127.0.0.1...
> > Connected to localhost.
> > Escape character is '^]'.
> > Android Console: type 'help' for a list of commands
> > OK
>
> > This seems to be repeatable; i.e., exactly this multiple retry each
> > time I try the telnet...
> > Is this common, the need to retry??
>
> > Thanks,
> > Ken
>
> > On Apr 10, 7:56 am, Digit <[EMAIL PROTECTED]> wrote:
> > > what about making the connection manually to see if the console is
> > > responding ?
> > > (yes, you can have several clients connected simultaneously to the same
> > > console)
>
> > > you're running your Java program example on OS X, not the emulator, right
> > ?
>
> > > On Thu, Apr 10, 2008 at 1:28 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]>
> > > wrote:
>
> > > > I didn't say it, but yes I already have the emulator running before I
> > > > run the connection test.
> > > > I haven't installed any Activity/Service yet for handling the SMS
> > > > message, but since the
> > > > emulator is running, I would expect the socket connection to be made.
>
> > > > --Ken
>
> > > > On Apr 9, 10:43 pm, "John P." <[EMAIL PROTECTED]> wrote:
> > > > > You need something on the other end accepting a connection request on
> > > > > port 5554. In your case, run the emulator first.
>
> > > > > On Apr 9, 9:16 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
>
> > > > > > Hi All,
>
> > > > > > Inhttp://
> > > > groups.google.com/group/android-beginners/browse_thread/thread...
> > > > > > Digit suggested:
>
> > > > > > | you typically access the console by doing "telnet localhost
> > 5554",
> > > > > > but the
> > > > > > | cool thing is that you can also do that programmatically. what I
> > > > > > mean is
> > > > > > | that your program can do the following:
> > > > > > | 1/ connect to TCP port 5554 on localhost
> > > > > > | 2/ write the command "sms send <senderPhoneNumber>
> > <textMessage>"
> > > > > > followed
> > > > > > | by a newline character (i.e. '\n') followed by "quit\n"
> > > > > > | 3/ read any answer character from the connection (necessary on
> > > > > > Windows to
> > > > > > | avoid really weird Winsock-specific socket shutdown issues)
> > until
> > > > > > you
> > > > > > | encounter an error (which means the connection was closed)
>
> > > > > > I'm having trouble with Step 1/. I get "Connection Refused" when I
> > > > > > try the following simple test:
> > > > > > public class TestConsoleConnect
> > > > > > {
> > > > > > public static void main(String[] args){
> > > > > > InetAddress lh = null;
> > > > > > Socket skt = null;
> > > > > > try {
> > > > > > lh = InetAddress.getLocalHost();
> > > > > > } catch (UnknownHostException uhe){ }
> > > > > > try {
> > > > > > skt = new Socket( lh, 5554);
> > > > > > } catch (IOException ioe) {
> > > > > > System.out.println(ioe);
> > > > > > } finally { try { if (skt != null){ skt.close(); }
> > > > > > } catch (Exception
> > e){
> > > > } }
> > > > > > }
>
> > > > > > }
>
> > > > > > I'm running on Mac OS X 10.5 with SDK m5-rc15_mac-x86.
> > > > > > What am I missing or misunderstanding?
> > > > > > Thanks in advance,
> > > > > > Ken Bowen
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---