Click here to Skip to main content
15,886,067 members
Home / Discussions / C#
   

C#

 
AnswerRe: OOPS Case Study PinPopular
PIEBALDconsult4-Jun-12 6:06
mvePIEBALDconsult4-Jun-12 6:06 
AnswerRe: OOPS Case Study Pin
Paul Conrad4-Jun-12 6:35
professionalPaul Conrad4-Jun-12 6:35 
AnswerRe: OOPS Case Study PinPopular
Abhinav S4-Jun-12 7:45
Abhinav S4-Jun-12 7:45 
AnswerRe: OOPS Case Study Pin
thatraja4-Jun-12 17:21
professionalthatraja4-Jun-12 17:21 
GeneralRe: OOPS Case Study Pin
Richard MacCutchan4-Jun-12 22:28
mveRichard MacCutchan4-Jun-12 22:28 
GeneralRe: OOPS Case Study Pin
egenis5-Jun-12 21:09
egenis5-Jun-12 21:09 
AnswerRe: OOPS Case Study Pin
Richard MacCutchan4-Jun-12 22:31
mveRichard MacCutchan4-Jun-12 22:31 
QuestionSystem.Net.Sockets IPEndPoint Problem Pin
Midnight Ahri4-Jun-12 0:06
Midnight Ahri4-Jun-12 0:06 
i'm new at c#, so i convert my messenger project from vb.net to c#, but after dat the problem occurs.
i got an error saying
//The best overloaded method match for 'System.Net.Sockets.Socket.Receive(ref.System.Net.IPEndPoint)' has some invalid arguments// in this line :
C#
data = ReceivingClient.Receive(endPoint);


i've tried to convert it to Byte but still can't work.
can someone please tell me what's wrong? Frown | :(

here's the full code :
C#
public delegate void AddMessage(ref string message);

        private const int Port = 33333;

        private const string BroadcastAddress = "255.255.255.255";
        private UdpClient ReceivingClient;
        private UdpClient SendingClient;
        private Thread ReceivingThread;
        private bool EnableReceiver = true;

        public Client()
        {
            InitializeComponent();
        }

        private void Client_Load(object sender, EventArgs e)
        {
            InitializeSender();
            InitializeReceiver();
        }

        private void MessageReceived(ref string message)
        {
            textbox1.Text = message;
        }

        private void Receiver()
        {
            IPEndPoint endPoint = new IPEndPoint(IPAddress.Any, Port);
            AddMessage messageDelegate = MessageReceived;

            while ((EnableReceiver == true))
            {
                byte[] data = null;
                data = ReceivingClient.Receive(endPoint);
                string message = Encoding.ASCII.GetString(data);
                Invoke(messageDelegate, message);
            }
        }

        private void InitializeSender()
        {
            SendingClient = new UdpClient(BroadcastAddress, Port);
            SendingClient.EnableBroadcast = true;
        }

        private void InitializeReceiver()
        {
            ReceivingClient = new UdpClient(Port);

            ThreadStart start = new ThreadStart(Receiver);
            ReceivingThread = new Thread(start);
            ReceivingThread.IsBackground = true;
            ReceivingThread.Start();
        }


modify >>>>

finally i found it, like this :
C#
data = ReceivingClient.Receive(ref(endPoint));


thank you very much. Smile | :)

modified 4-Jun-12 6:25am.

AnswerRe: System.Net.Sockets IPEndPoint Problem Pin
Richard MacCutchan4-Jun-12 1:05
mveRichard MacCutchan4-Jun-12 1:05 
AnswerRe: System.Net.Sockets IPEndPoint Problem Pin
Luc Pattyn4-Jun-12 4:14
sitebuilderLuc Pattyn4-Jun-12 4:14 
QuestionSaving data to SQL from dynamically made comboboxes... Pin
Vidor3-Jun-12 22:27
professionalVidor3-Jun-12 22:27 
AnswerRe: Saving data to SQL from dynamically made comboboxes... Pin
AmitGajjar4-Jun-12 2:06
professionalAmitGajjar4-Jun-12 2:06 
GeneralRe: Saving data to SQL from dynamically made comboboxes... Pin
Vidor4-Jun-12 5:00
professionalVidor4-Jun-12 5:00 
GeneralRe: Saving data to SQL from dynamically made comboboxes... Pin
AmitGajjar4-Jun-12 17:55
professionalAmitGajjar4-Jun-12 17:55 
SuggestionRe: Saving data to SQL from dynamically made comboboxes... Pin
Paul Conrad4-Jun-12 17:07
professionalPaul Conrad4-Jun-12 17:07 
Questiondatabinding in the constuctor not working properly Pin
matleeds3-Jun-12 22:02
matleeds3-Jun-12 22:02 
AnswerRe: databinding in the constuctor not working properly Pin
matleeds3-Jun-12 22:57
matleeds3-Jun-12 22:57 
GeneralRe: databinding in the constuctor not working properly Pin
Luc Pattyn4-Jun-12 4:18
sitebuilderLuc Pattyn4-Jun-12 4:18 
AnswerRe: databinding in the constuctor not working properly Pin
mallikharjuna2214-Jun-12 21:20
mallikharjuna2214-Jun-12 21:20 
QuestionC# 2010 edit Pin
dcof3-Jun-12 18:08
dcof3-Jun-12 18:08 
AnswerRe: C# 2010 edit Pin
Richard MacCutchan3-Jun-12 22:09
mveRichard MacCutchan3-Jun-12 22:09 
AnswerRe: C# 2010 edit Pin
Eddy Vluggen4-Jun-12 3:30
professionalEddy Vluggen4-Jun-12 3:30 
Questionc# DataGridView EditMode and DeleteKey Pin
blissMaster3-Jun-12 15:25
blissMaster3-Jun-12 15:25 
AnswerRe: c# DataGridView EditMode and DeleteKey Pin
Abhinav S3-Jun-12 17:16
Abhinav S3-Jun-12 17:16 
Questionconvert part of a list to an array Pin
a.fatemeh3-Jun-12 7:18
a.fatemeh3-Jun-12 7:18 

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.