Click here to Skip to main content
15,914,165 members
Home / Discussions / C#
   

C#

 
GeneralRe: C# Open Dialog Box Pin
HyVong25-Jun-04 3:25
HyVong25-Jun-04 3:25 
Generalquery builer Pin
Member 114126624-Jun-04 2:35
Member 114126624-Jun-04 2:35 
GeneralMS Project 2003 Pin
frankvgb24-Jun-04 1:41
frankvgb24-Jun-04 1:41 
GeneralRe: MS Project 2003 Pin
Heath Stewart24-Jun-04 6:23
protectorHeath Stewart24-Jun-04 6:23 
Questionserver name? Pin
quocbao24-Jun-04 1:19
quocbao24-Jun-04 1:19 
AnswerRe: server name? Pin
Heath Stewart24-Jun-04 6:37
protectorHeath Stewart24-Jun-04 6:37 
Questionserver name? Pin
quocbao24-Jun-04 1:18
quocbao24-Jun-04 1:18 
QuestionHow to write a Async UDP socket code? Pin
fu023-Jun-04 20:53
fu023-Jun-04 20:53 
I want to create a Listening UDP socket in Async Mode.
here is my code:

private void button7_Click(object sender, System.EventArgs e)
{
sock = new Socket(AddressFamily.InterNetwork,SocketType.Dgram,ProtocolType.Udp);
iep = new IPEndPoint(IPAddress.Any,20100);
sock.Bind(iep);
sock.BeginReceive(data,0,1024,SocketFlags.None,new AsyncCallback(ReceiveData),sock);
}

private void ReceiveData(IAsyncResult iar)
{
Socket remote = (Socket)iar.AsyncState;
int recv = remote.EndReceive(iar);
Console.WriteLine("Recv {0}:",recv);
remote.BeginReceive(data,0,1024,SocketFlags.None,new AsyncCallback(ReceiveData),sock);
}

//////////////////////////////
i want the sock to keep listening.
However, once i send a udp message with UDPClient from another pc, the ReceiveData(IAsyncResult iar) method turns into a loop keeping writeline.
what is wrong ?

AnswerRe: How to write a Async UDP socket code? Pin
Heath Stewart24-Jun-04 6:41
protectorHeath Stewart24-Jun-04 6:41 
GeneralRe: How to write a Async UDP socket code? Pin
fu024-Jun-04 22:15
fu024-Jun-04 22:15 
GeneralRe: How to write a Async UDP socket code? Pin
Heath Stewart25-Jun-04 3:41
protectorHeath Stewart25-Jun-04 3:41 
GeneralRe: How to write a Async UDP socket code? Pin
fu027-Jun-04 16:12
fu027-Jun-04 16:12 
GeneralSaving DataSet with calculated columns Pin
myNameIsRon23-Jun-04 19:58
myNameIsRon23-Jun-04 19:58 
GeneralRe: Saving DataSet with calculated columns Pin
Heath Stewart24-Jun-04 5:32
protectorHeath Stewart24-Jun-04 5:32 
GeneralRe: Saving DataSet with calculated columns Pin
myNameIsRon25-Jun-04 8:54
myNameIsRon25-Jun-04 8:54 
Generalproject problem Pin
dan_ta2223-Jun-04 19:34
dan_ta2223-Jun-04 19:34 
GeneralRe: project problem Pin
Xiangyang Liu 刘向阳24-Jun-04 1:38
Xiangyang Liu 刘向阳24-Jun-04 1:38 
GeneralRe: project problem Pin
dan_ta2227-Jun-04 14:24
dan_ta2227-Jun-04 14:24 
GeneralRe: project problem Pin
LongRange.Shooter24-Jun-04 8:52
LongRange.Shooter24-Jun-04 8:52 
GeneralRe: project problem Pin
dan_ta2227-Jun-04 14:29
dan_ta2227-Jun-04 14:29 
GeneralA windows service with System.Web.Mail Pin
Valdair23-Jun-04 15:09
Valdair23-Jun-04 15:09 
GeneralRe: A windows service with System.Web.Mail Pin
eggie523-Jun-04 16:05
eggie523-Jun-04 16:05 
GeneralRe: A windows service with System.Web.Mail Pin
Valdair24-Jun-04 7:04
Valdair24-Jun-04 7:04 
GeneralRe: A windows service with System.Web.Mail Pin
Heath Stewart24-Jun-04 12:44
protectorHeath Stewart24-Jun-04 12:44 
GeneralSurprising performance difference Pin
the real bryon23-Jun-04 12:09
the real bryon23-Jun-04 12:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.