[Q] [Help ME]Mono Android with MVS 2010
Hi guys, I'm new to C# and Mono Android. I have tried to make a app, but it gives me a error, I want to ping a address, this is the error
here's the code,
using System;
using System.Text;
using System.Net.NetworkInformation;
using System.Net.Sockets;
using System.Net;
using Android.App;
using Android.Content;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;
using Android.Media;
namespace FirstAAp
{
[Activity(Label = "FirstAAp", MainLauncher = true, Icon = "@drawable/icon")]
public class Activity1 : Activity
{
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
// Set our view from the "main" layout resource
SetContentView(Resource.Layout.Main);
// Get our button from the layout resource,
// and attach an event to it
Button button = FindViewById
button.Click += new EventHandler(button_Click);
}
void button_Click(object sender, EventArgs e)
{
Ping psend = new Ping();
PingOptions options = new PingOptions();
options.DontFragment = true;
string data = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
byte[] buffer = ASCIIEncoding.ASCII.GetBytes(data);
int timeout1 = 120;
PingReply reply1 = psend.Send("65.32.233.229", timeout1, buffer, options);
if (reply1.Status == IPStatus.Success)
{
Title = "It's available";
}
else
{
Title = "It's not available";
}
}
}
}
Please Help me
--------------------------------------------------------------------------
----------------------------------------------------------------------------------------------Thanks to UKICAR@XDA
.
forums.androidcentral.com
No comments:
Post a Comment