On form load it preforms this action: -
string IP = "*";
-
int Port = *;
-
IPEndPoint RemoteEndPoint = new IPEndPoint(System.Net.IPAddress.Parse(IP), Port);
-
UdpClient Client = new UdpClient();
-
byte[] sendDatagram = { 0xff, 0xff, 0xff, 0xff, 0x54, 0x53, 0x6f, 0x75, 0x72, 0x63,
-
0x65, 0x20, 0x45, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x20, 0x51,
-
0x75, 0x65, 0x72, 0x79, 0x0 };
-
byte[] receiveDatagram;
-
try
-
{
-
Client.Send(sendDatagram, sendDatagram.Length, RemoteEndPoint);
-
receiveDatagram = Client.Receive(ref RemoteEndPoint);
-
Client.Close();
-
label1.Text = Encoding.ASCII.GetString(receiveDatagram, 6, 117).ToString();
-
labelResult.Text = receiveDatagram.Length.ToString();
-
}
-
catch (Exception ex)
-
{
-
MessageBox.Show(ex.ToString());
-
return;
-
}
-
As result I get the server name of a gameserver running on that IP address with that port.
But how do I get more results from the datagram? Ive gotten this code from a Visual Basic program and that can see the current amount of players and map etc.
How can I get this to show in C#?
0 995 Sign in to post your reply or Sign up for a free account.
Similar topics
by: Dave |
last post by:
Hi,
This is doubtless a really dumb question but is there an elegant way
of reading numbers formatted as hex from a datgram?
I get a datgram which contains values like this:
---DATAGRAM---...
|
by: Jonathan Ellis |
last post by:
I seem to be running into a limit of 64 queued datagrams. This isn't a
data buffer size; varying the size of the datagram makes no difference
in the observed queue size. If more datagrams are...
|
by: Gregory Hassett |
last post by:
Hello,
Does anyone know how to get the maximum size of a datagram for a UDP Socket
created via .NET's System.Net.Sockets.Socket class?
Thanks!
|
by: Iain King |
last post by:
Hi. I've been looking everywhere for this and can't find it, apologies
if I'm being obtuse: How do I set the max datagram packet size? I'm
using the socket module. It seem like it's hardcoded...
|
by: alberto.castellin |
last post by:
Hi to all,
I've this problem:
I create a datagram socket. I create datagram socket with function
'Create'. The line of my code when I create is:
m_pSocket->Create(port,SOCK_DGRAM,FD_READ |...
|
by: DaTurk |
last post by:
I know in TCP if you send a message down the wire, the OS may lump
subsequent messages into a buffer before sending it across the wire,
for efficiency. But, will the OS do the same thing with UDP?...
|
by: greenxiar |
last post by:
My code is below and the platform is Win2K3 R2:
using System;
using System.Net;
using System.Net.Sockets;
using System.Threading;
namespace TechUDPBroadcast {
class Program {
static void...
|
by: 7stud |
last post by:
I'm trying to understand datagrams. My client program sends a message
to the server, and then the server infinitely loops over the recv() to
make sure all the data was received. I'm trying to use...
|
by: sfncook |
last post by:
Hi, As far as I can tell you can't call the accept function on a
datagram socket. So why did this guy publish this sample code?
http://www.codersource.net/winsock_tutorial_server_select_model.html...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |