Click here to Skip to main content
15,897,291 members
Home / Discussions / C#
   

C#

 
GeneralMy project is not reflecting current changes Pin
R.A.C11-Feb-08 9:45
R.A.C11-Feb-08 9:45 
GeneralRe: My project is not reflecting current changes Pin
Pete O'Hanlon11-Feb-08 10:06
mvePete O'Hanlon11-Feb-08 10:06 
GeneralRe: My project is not reflecting current changes Pin
Luc Pattyn11-Feb-08 10:38
sitebuilderLuc Pattyn11-Feb-08 10:38 
QuestionUDP Send function sends duplicate data Pin
Chase Davis11-Feb-08 9:34
Chase Davis11-Feb-08 9:34 
GeneralRe: UDP Send function sends duplicate data Pin
led mike11-Feb-08 10:01
led mike11-Feb-08 10:01 
GeneralRe: UDP Send function sends duplicate data Pin
Chase Davis11-Feb-08 11:09
Chase Davis11-Feb-08 11:09 
GeneralRe: UDP Send function sends duplicate data Pin
led mike11-Feb-08 11:16
led mike11-Feb-08 11:16 
GeneralRe: UDP Send function sends duplicate data Pin
Chase Davis11-Feb-08 12:30
Chase Davis11-Feb-08 12:30 
Well, I thought about that. However, I used a program from the customer that monitors UDP data and the same thing happens. In any case, here is the receive code:

// local member of the form
Socket s = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);

private void btnStart_Click(object sender, System.EventArgs e)
{
// user defined class to contain socket information
StateObject state = new StateObject();
state.workSocket = s;

EndPoint ipep = new IPEndPoint(IPAddress.Any, Convert.ToInt32(txtPortNum.Text, 10));
// only bind if it has not been bound yet
if (s.LocalEndPoint == null)
s.Bind(ipep);
s.BeginReceiveFrom(state.buffer, 0, StateObject.BufferSize, SocketFlags.None, ref ipep, new AsyncCallback(OnReceive), state);
}

void OnReceive(IAsyncResult iar)
{
StateObject state = (StateObject)iar.AsyncState;
Socket client = state.workSocket;
EndPoint epRemote = new IPEndPoint(IPAddress.Any, Convert.ToInt32(txtPortNum.Text, 10));
int bytesRead = client.EndReceiveFrom(iar, ref epRemote);

string str = Encoding.ASCII.GetString(state.buffer);
// do stuff with the string
s.BeginReceiveFrom(state.buffer, 0, StateObject.BufferSize, SocketFlags.None, ref epRemote, new AsyncCallback(OnReceive), state);
}

Chase Davis
GeneralRe: UDP Send function sends duplicate data Pin
led mike12-Feb-08 9:30
led mike12-Feb-08 9:30 
Generalan application for showing shared files using c# and .net Pin
addemy11-Feb-08 7:24
addemy11-Feb-08 7:24 
GeneralRe: an application for showing shared files using c# and .net Pin
led mike11-Feb-08 7:51
led mike11-Feb-08 7:51 
GeneralRe: an application for showing shared files using c# and .net Pin
addemy11-Feb-08 7:59
addemy11-Feb-08 7:59 
GeneralRe: an application for showing shared files using c# and .net [modified] Pin
led mike11-Feb-08 8:13
led mike11-Feb-08 8:13 
Generalsystem.drawing.color [modified] Pin
s3rro11-Feb-08 7:11
s3rro11-Feb-08 7:11 
GeneralRe: system.drawing.color Pin
led mike11-Feb-08 8:07
led mike11-Feb-08 8:07 
GeneralRe: system.drawing.color Pin
Insincere Dave11-Feb-08 8:34
Insincere Dave11-Feb-08 8:34 
GeneralRe: system.drawing.color Pin
led mike11-Feb-08 8:38
led mike11-Feb-08 8:38 
GeneralRe: system.drawing.color Pin
s3rro11-Feb-08 8:53
s3rro11-Feb-08 8:53 
GeneralRe: system.drawing.color Pin
Pete O'Hanlon11-Feb-08 10:16
mvePete O'Hanlon11-Feb-08 10:16 
QuestionRequest is not available in this context Pin
Ryno Burger11-Feb-08 6:18
Ryno Burger11-Feb-08 6:18 
GeneralRe: Request is not available in this context Pin
led mike11-Feb-08 6:22
led mike11-Feb-08 6:22 
GeneralRe: Request is not available in this context Pin
Ryno Burger11-Feb-08 6:27
Ryno Burger11-Feb-08 6:27 
GeneralRe: Request is not available in this context Pin
led mike11-Feb-08 6:47
led mike11-Feb-08 6:47 
GeneralRe: Request is not available in this context Pin
Not Active11-Feb-08 6:24
mentorNot Active11-Feb-08 6:24 
GeneralRe: Request is not available in this context Pin
Steve Westbrook11-Feb-08 6:38
Steve Westbrook11-Feb-08 6:38 

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.