R
roberto
Hi,well i'm trying to listen from a network card the traffic incoming.
I tried about hundred times :-( in different ways after reading many
previous posts...but i'm always getting errors.
This is my last piece of code NOT working:
private void button1_Click(object sender, System.EventArgs e)
{
Socket mysock = new
Socket(AddressFamily.InterNetwork,SocketType.Dgram,
ProtocolType.Udp);
IPEndPoint iep = new
IPEndPoint(IPAddress.Parse("239.0.4.17"),9000);//This is port i listen
from
// mysock.Bind(iep);->>>>>>>>ERROR IF i Bind
mysock.SetSocketOption(
SocketOptionLevel.IP,SocketOptionName.AddMembership,
new MulticastOption(IPAddress.Parse("192.168.238.238")));//--->>>>>>>This
is ip of my sat card
byte[] mydata = new Byte[1024];
int n = mysock.Receive
(mydata,mydata.Length,SocketFlags.None);->>>>>HERE Exception 10022
Invalid argument so never tested next lines.....
String mystring = System.Text.Encoding.ASCII.GetString(mydata);
TextBox1.AppendText(mystring);
}
What I'd like to do is to read incoming datagrams from that port only
by that network card,parse them to extract data i want and show them.
Thanks to anyone who could help me.
I tried about hundred times :-( in different ways after reading many
previous posts...but i'm always getting errors.
This is my last piece of code NOT working:
private void button1_Click(object sender, System.EventArgs e)
{
Socket mysock = new
Socket(AddressFamily.InterNetwork,SocketType.Dgram,
ProtocolType.Udp);
IPEndPoint iep = new
IPEndPoint(IPAddress.Parse("239.0.4.17"),9000);//This is port i listen
from
// mysock.Bind(iep);->>>>>>>>ERROR IF i Bind
mysock.SetSocketOption(
SocketOptionLevel.IP,SocketOptionName.AddMembership,
new MulticastOption(IPAddress.Parse("192.168.238.238")));//--->>>>>>>This
is ip of my sat card
byte[] mydata = new Byte[1024];
int n = mysock.Receive
(mydata,mydata.Length,SocketFlags.None);->>>>>HERE Exception 10022
Invalid argument so never tested next lines.....
String mystring = System.Text.Encoding.ASCII.GetString(mydata);
TextBox1.AppendText(mystring);
}
What I'd like to do is to read incoming datagrams from that port only
by that network card,parse them to extract data i want and show them.
Thanks to anyone who could help me.