I have to write an Application which shares data over an Wireless Ad Hoc Network.
And I have No Idea how to do this. I am good at C# so I am thinking to choose C# for writting the Application
First question- How to read Data Received over WiFi or How to send Data over WiFi... Means is there a开发者_StackOverflowny Port to which I should Read/Write?
Second Question- All the Protocol Management stuff is done by Adapter or my Application should that?
And also suggest some reading which I should go for! I read basics of WiFi and how it works and all!
Regards!
You need to start reading about Native Wifi for Windows XP SP3/Win2k/Vista/7.
1.you can use socket programming and get/send data with this code.
public void get_data_from_server()
{
try
{
while (true)
{
byte[] b = new byte[1024];
int r = SocClient.Receive(b);
if (r > 0)
{
this.Invoke((MethodInvoker)delegate
{
listBoxclient.Items.Add(Encoding.Unicode.GetString(b, 0, r));
sock.Text = "socket_client == Connected";
sock.ForeColor = Color.Green;
});
}
Thread.Sleep(400);
}
}
catch
{
;
}
}
private void sending_client_to_server()
{
try
{
while (true)
{
string datetime = gettime();
string ipee =get_ip_address();
byte[] b = Encoding.Unicode.GetBytes(ipee + " : " + "5050" + " " + datetime);
SocClient.Send(b);
delay();
Thread.Sleep(400);
}
}
catch
{
;
}
}
2.you can use TCP or UDP and do this.
3.you must read socket programing in C#
精彩评论