|
I think Vista might be the culprit....
Anyway, could anyone share with me how to send some data over UDP and recieve it?
Now it's not working, and I have no clue if it's the sending or recieving or both which fails....
Anyway I have simple code like that:
public void Send(byte[] data, IPEndPoint to)<br />
{<br />
using (Socket sock = new Socket(to.AddressFamily, SocketType.Dgram, ProtocolType.Udp))<br />
sock.SendTo(data, SocketFlags.None, to);<br />
}<br />
<br />
<br />
public void Receiving()<br />
{<br />
byte[] rbuf = new byte[1 << 14];<br />
using (Socket sock = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp))<br />
{<br />
sock.Bind(new IPEndPoint(IPAddress.Any, aPort));<br />
while (true)<br />
{<br />
EndPoint rep = new IPEndPoint(IPAddress.Any, 0);<br />
int read = sock.ReceiveFrom(rbuf, ref rep);<br />
Recieved(rbuf, read, rep);<br />
}<br />
}<br />
}<br />
void Recieved(byte[] buf, int nRead, EndPoint where)<br />
{<br />
Console.WriteLine("Recieved {0} byte(s) from {1}", nRead, where);<br />
}
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....
_________________________________________________________
My programs never have bugs, they just develop random features.
modified on Tuesday, June 17, 2008 10:58 AM
|
|
|
|
|
Can you post here Error message which you are getting ?
Parwej Ahamad
R & D: REST services with WCF
|
|
|
|
|
Thanks for replying!
Anyway I figured it out (see my other post).
In answer to your question, however, it didn't thrown any error at all!
That is, until I thought of trying to run the server as an Administrator.
Then I got a SocketException which told me to use sock.Bind() first.
As to why it fails silently when I run as a normal user, it's a mystery...
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....
_________________________________________________________
My programs never have bugs, they just develop random features.
|
|
|
|
|
Never mind,I found it!
I should also (in the listenin code)
sock.Bind(new IPEndPoint(IPAddress.Any, aPort))
Pay attention to 'aPort' I should use the same port for target IPEndPoint when sending data
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....
_________________________________________________________
My programs never have bugs, they just develop random features.
|
|
|
|
|
Hi,
Has any one worked with the entity framework? Is it worth while using? I am looking for a solution for code generation, I have tried out Codesmith Tools but the support lacks.
Can I please hear comments on the entity framework. Where can I currently get it for download? I know that the full solution is available in SP1 for Visual Studio. I wonder when this will be released?
Thanks
Brendan
|
|
|
|
|
I believe it's being released this summer as part of .NET 3.5 Service Pack 1.
Life, family, faith: Give me a visit.
From my latest post: "A lot of Christians struggle, perhaps at a subconscious level, about the phrase "God of Israel". After all, Israel's God is the God of Judaism, is He not? And the God of Christianity is not the God of Judaism, right?"
Judah Himango
|
|
|
|
|
When is summer?? It's helps me not, I stay in South Africa.
|
|
|
|
|
Summer is just starting here in the US. It will probably be released within 1-2 months. If you want to try out these bits, there's a public beta for the Entity Framework out there.
Life, family, faith: Give me a visit.
From my latest post: "A lot of Christians struggle, perhaps at a subconscious level, about the phrase "God of Israel". After all, Israel's God is the God of Judaism, is He not? And the God of Christianity is not the God of Judaism, right?"
Judah Himango
|
|
|
|
|
Have you worked with it before, or played around enough with the entity framework? Is it good? How is the design? Is it like an ORM?
|
|
|
|
|
Hi, I am trying to read in a attribute that I have added to some fields (not all my fields have this attribute). That is what I want to base my loop through all the controls on a page with.
Custom attribute is: PDFField
ex: <asp:textbox id="txt_Custom1" runat="server" pdffield="txtCustNo" xmlns:asp="#unknown">
now each page can have mutiple or zero "custom" textboxes or any other input types.
so far I cant seem to find a way to access each control to find if they have the PDFField attribute. Does anyone know how to do this?
Thanks,
Zach Bob
|
|
|
|
|
Hi,
Isn't is just to read it using
if(txt_Custom1.Attributes["pdffield"] != null) { do anything with it.... }
I guess you know how to sweep through all controls in the form.
Hope this helps.
Those who want most to speak up, are often those who have nothing clever to say.
modified on Friday, June 20, 2008 3:33 AM
|
|
|
|
|
|
You asked this in the C# and VB.NET forums. your code is VB. Please don't cross post.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Could not get any help from there?
r00d0034@yahoo.com
|
|
|
|
|
imran_rafique wrote: Could not get any help from there?
If you can't get help in the VB forum, why do you think you'll fare any better in the C# forum?
|
|
|
|
|
How to convert long type to twodimensionalarray conversion
for example
private long nP;
public long giveNewPolygs(ref PointF[][] newP)
{
long n;
try
{
n = p[0].Length;
n = p.Length - 1;
}
catch (Exception ex)
{
return -1;
}
newP = nP;
newP = p;
return n;
}
|
|
|
|
|
The real question is, how do you WANT to turn a single number into a 2D array of points ?
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
really i dont understand that answer.
please give me the correct code conversion for array[][] to long.
|
|
|
|
|
I am speechless.
I can convert a single long into a 2D array any number of ways. There is no actual, obvious conversion. Therefore, you need to explain yourself better, because the odds are that if I make up an answer, I will answer the question, without helping you. Is the long a pointer to an array, is that the problem ?
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
What do you actually want to do here?
Manoj
Never Gives up
|
|
|
|
|
This is my code part. In here i want the conversion for newP = nP;
private long nP;
public long giveNewPolygs(ref PointF[][] newP)
{
long n;
try
{
n = p[0].Length;
n = p.Length - 1;
}
catch (Exception ex)
{
return -1;
}
newP = nP;
newP = p;
return n;
}
|
|
|
|
|
There is no such conversion predefined, and there is no obvious way of constructing a conversion like that.
What is your idea about what a conversion like that would do? For any given example value, what would you expect the result to be?
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Good luck - he stopped answering when I asked the same thing.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hello everyone,
Will this way faster if I need to supply CultureInfo, compared with calling CultureInfo.CurrentCulture each time?
1. using a static member CultureInfo, and retrieve only once using CultureInfo.CurrentCulture;
2. when need to supply CultureInfo, provide the static member reference.
thanks in advance,
George
|
|
|
|
|
Have you tried timing it yourself?
“It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration.”
-Edsger Dijkstra
|
|
|
|