INTERNET

by Mitch » Thu, 20 Aug 2009 14:20:18 GMT


Sponsored Links
 I would like to play around with sockets to see if I can get them to
work, but I'm not having any luck.  Here's what I tried:

new Socket("www.google.com", 80);

I've also tried

new Socket("localhost", 7);

but anything you can suggest that's simple is appreciated.  I'm no
socket expert so I'm not sure if these are considered simple
examples.

I read that I should add INTERNET permission to my manifest, so I did
this too:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android=" http://schemas.android.com/apk/res/android" ;
      package="com.kea"
      android:versionCode="1"
      android:versionName="1.0">
    <application android:icon="@drawable/icon" android:label="@string/
app_name">
        <activity android:name=".ServSock"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category
android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
    <uses-sdk android:minSdkVersion="3" />
<uses-permission android:name="android.permission.INTERNET"></uses-
permission>
</manifest>

I'm just trying to learn so there's no real goal, just looking for a
simple example that I can get working.  Any hints what I'm missing?
Thanks.


--~--~---------~--~----~------------~-------~--~----~



INTERNET

by John P. » Thu, 20 Aug 2009 23:23:52 GMT


 I don't think you want to use sockets if the receiving end isn't setup
to listen for them (in your case of www.google.com).  If you want to
communicate with http protocol, use a Http class.  It may be possible
to build your own HTTP reader using sockets, but there's already one
available from standard Java SDK.

The second attempt to communicate with localhost also needs a
receiving listener to work.  Also if you are using an emulator to
access your hosting computer, use 10.0.2.2 (see
 http://developer.android.com/guide/appendix/faq/commontasks.html #localhostalias).



--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


INTERNET

by Roman ( T-Mobile USA) » Fri, 21 Aug 2009 05:54:21 GMT


 It really depends on what you are trying to accomplish. If you want to
implement an application simple application using sockets you can try
so setup a server on your desktop and execute the following commands
from the Android device

                Socket s = new Socket("<IP address of server", <port
on desktop>);
                PrintWriter out = new PrintWriter(s.getOutputStream(),
true);
                out.println("Hello World");


The server should listen on the port you have specified in your
Android app. If you don't want to implement any server you also can
download netcat. It is a very powerful TCP/IP testing tool.

--
Roman Baumgaertner
Sr. SW Engineer-OSDC
T  Mobile stick together
The views, opinions and statements in this email are those of the
author solely in their individual capacity, and do not necessarily
represent those of T-Mobile USA, Inc.



--~--~---------~--~----~------------~-------~--~----~



INTERNET

by Roman ( T-Mobile USA) » Fri, 21 Aug 2009 06:05:23 GMT


 It really depends on what you are trying to accomplish. If you want to
implement a simple application using sockets you can try
so setup a server on your desktop and execute the following commands
from the Android device

                Socket s = new Socket("<IP address of server", <port
on desktop>);
                PrintWriter out = new PrintWriter(s.getOutputStream(),
true);
                out.println("Hello World");

The server should listen on the port you have specified in your
Android app. If you don't want to implement any server you also can
download netcat. It is a very powerful TCP/IP testing tool.

--
Roman Baumgaertner
Sr. SW Engineer-OSDC
T  Mobile stick together
The views, opinions and statements in this email are those of the
author solely in their individual capacity, and do not necessarily
represent those of T-Mobile USA, Inc.



--~--~---------~--~----~------------~-------~--~----~



INTERNET

by Mitch » Fri, 21 Aug 2009 11:52:29 GMT


 I'm not trying to use HTTP, the "www.google.com" was just a URL I knew
would be able to respond.  Turns out that if I replace the
"www.google.com" with it's IP "74.125.53.105" then it works.  Don't
know why.

I would like to get 2 android simulators talking so I can test 2 way
communications with data.  I haven't found out how to get 2 simulators
up yet either.



--~--~---------~--~----~------------~-------~--~----~



INTERNET

by Roman ( T-Mobile USA) » Sat, 22 Aug 2009 02:08:52 GMT


 If you use an emulator try to set your DNS when you start the emulator

./emulator -dns-server <ip-address>

--
Roman Baumgaertner
Sr. SW Engineer-OSDC
T  Mobile stick together
The views, opinions and statements in this email are those of the
author solely in their individual capacity, and do not necessarily
represent those of T-Mobile USA, Inc.




--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. .Net Developer Job Opening - Valencia, CA

Hi

This is Vignesh with Makro Technologies, Inc.
We have been in business for over 10 years and we are one of the Fast 500
National IT staffing and Solution firms in USA. Our clients include
country top-notch IT, Healthcare, Pharmaceutical, Financial,
Telecom,Government and other industries.

Staying current with technology, finding great consultants and exceeding our
clients' expectations are our primary objectives.

Thanks for your time and attention to this e-mail.  Please let me know if
you have any candidates available, please find the Job description as
mentioned below.

*Title : .Net Developer
Location : Valencia, CA
Duration :6 Months*
*Responsibilities:*
Work closely with business representatives and other team members to
understand business requirements that drive the analysis, design and
development of quality technical solutions that align with business and IT
strategies and comply with corporate and regulatory standards
Direct and participate in the full software development lifecycle
Make recommendations towards the development of new systems or reuse of
existing systems
Work on medium to large, varied and complex projects that require skill in
multiple technical environments and knowledge in various business areas
Work on multiple simultaneous projects as a project team member and/or as
a project lead
Coach and/or mentor more junior technical staff
*
Required Skills*
Bachelor degree in Computer Science or a related area
7+ years of programming/systems analysis experience
Waterfall SDLC experience
Ability to be a self-starter in a dynamic and fast paced environment
Microsoft technologies, including .Net, C#, VB.Net, ASP.Net, XML, HTML,
JavaScript.
Tools: Visual Studio .Net 2008, SQL Server 2000-2008, SVN
Database technologies: Microsoft SQL, Oracle PL/SQL
Reporting systems: Crystal Reports Server 2008
Regulatory software validation experience a plus

Thanks
*Vignesh
*Sr Talent Acquisation Consultant
Tel: 973-481-0100  Ext: 3069
Fax: 973 883 1488
*E mail:* vignesh.renik...@makrohealth.com
Linkedin: 
*http://www.linkedin.com/in/vignesh1*<http://www.linkedin.com/in/vignesh1>
(Accept
All Invitations to your's and My Professional Network)
http://www.twitter.com/Makro_Tech (follow me get Followed back)

For current openings please visit
http://jobs.makrotech.com/searchjobs.aspx

Candidate HelpDesk: 973-679-5005
*
Makro Technologies Inc.*
www.makrotech.com
Corporate Headquarters: New Jersey
One Washington Park, Suite 1502, Newark, NJ 07102
*Other Offices:* Pennsylvania, Illinois, California
** Makro is a 3-time INC 5000 company for 2007/2008/2009
** Makro is a 3-time FAST 50 firm in NJ for 2005/2006/2007 (by Deloitte)
** Makro is a 3-time FAST 500 firm in USA for 2005/2006/2007 (by
Deloitte)

-- 

2. Testing Topic Please ignore

I keep posting, but they are not showing up... maybe its becuase of code 
examples in the txt... 

-- 

3. Text drawn by mPaint.drawText looks different with the default TextView?

4. Market Statistics not working

5. Porting android on a basic phone

6. Android horizontal scroll list like Gallery

7. Loading/flashing system.img, userdata.img on Samsung Galaxy 3 (I5801)