Click here to Skip to main content
15,905,229 members
Home / Discussions / C#
   

C#

 
AnswerRe: SQL Connection Problem Pin
J4amieC27-Oct-09 1:05
J4amieC27-Oct-09 1:05 
AnswerRe: SQL Connection Problem Pin
Emmet_Brown27-Oct-09 1:13
Emmet_Brown27-Oct-09 1:13 
QuestionMy custom control can´t get out from the GroupBox it belongs... Pin
the_savage_poetry27-Oct-09 0:47
the_savage_poetry27-Oct-09 0:47 
Questionlistbox selectedvaluechanged event fires programmaticlly !!! [modified] Pin
Hussam Fattahi27-Oct-09 0:47
Hussam Fattahi27-Oct-09 0:47 
AnswerRe: listbox selectedvaluechanged event fires programmaticlly !!! Pin
Henry Minute27-Oct-09 4:58
Henry Minute27-Oct-09 4:58 
GeneralRe: listbox selectedvaluechanged event fires programmaticlly !!! Pin
Hussam Fattahi27-Oct-09 5:25
Hussam Fattahi27-Oct-09 5:25 
GeneralRe: listbox selectedvaluechanged event fires programmaticlly !!! Pin
Henry Minute27-Oct-09 5:29
Henry Minute27-Oct-09 5:29 
QuestionHow to implement a socket (IP layer) packets using C# ? Pin
3bood.ghzawi27-Oct-09 0:25
3bood.ghzawi27-Oct-09 0:25 
AnswerRe: How to implement a socket (IP layer) packets using C# ? Pin
spiritboy27-Oct-09 0:31
spiritboy27-Oct-09 0:31 
Question[Message Deleted] Pin
saurabh8april27-Oct-09 0:16
saurabh8april27-Oct-09 0:16 
AnswerRe: collapsible meanubar Pin
Philip.F27-Oct-09 0:25
Philip.F27-Oct-09 0:25 
GeneralRe: collapsible meanubar Pin
saurabh8april27-Oct-09 0:31
saurabh8april27-Oct-09 0:31 
GeneralRe: collapsible meanubar Pin
Calla27-Oct-09 1:07
Calla27-Oct-09 1:07 
Questioninteracting with windows service Pin
Chesnokov Yuriy26-Oct-09 23:19
professionalChesnokov Yuriy26-Oct-09 23:19 
AnswerRe: interacting with windows service Pin
spiritboy27-Oct-09 0:17
spiritboy27-Oct-09 0:17 
AnswerRe: interacting with windows service Pin
Chesnokov Yuriy27-Oct-09 1:28
professionalChesnokov Yuriy27-Oct-09 1:28 
AnswerRe: interacting with windows service [modified] Pin
Hristo-Bojilov27-Oct-09 0:46
Hristo-Bojilov27-Oct-09 0:46 
GeneralRe: interacting with windows service Pin
Chesnokov Yuriy27-Oct-09 1:23
professionalChesnokov Yuriy27-Oct-09 1:23 
GeneralRe: interacting with windows service Pin
Hristo-Bojilov27-Oct-09 1:45
Hristo-Bojilov27-Oct-09 1:45 
Questionproblem with client/server application Pin
Ajithevn26-Oct-09 23:00
Ajithevn26-Oct-09 23:00 
AnswerRe: problem with client/server application Pin
Christian Graus26-Oct-09 23:37
protectorChristian Graus26-Oct-09 23:37 
GeneralRe: problem with client/server application Pin
Ajithevn27-Oct-09 0:34
Ajithevn27-Oct-09 0:34 
there are 2 systems with ips 192.168.1.87(clientA,serverA) and 192.168.1.35(clientB,serverB) . on both the systems client and server runs.
now clientA sends a message to serverB on button click. as soon as serverB recieves a message it should send that message to ClientB
how is that possible
clientA--->serverB(onmessagerecieved)--->cientB

server:-
int recv;
byte[] data = new byte[1024];
IPEndPoint ipep = new IPEndPoint(IPAddress.Any, 10294);
Socket newsock = new Socket(AddressFamily.InterNetwork,
SocketType.Dgram, ProtocolType.Udp);
newsock.Bind(ipep);
newsock.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.AddMembership, new MulticastOption(IPAddress.Any, IPAddress.Parse("127.0.0.1")));

while (true)
{
   IPEndPoint sender2 = new IPEndPoint(IPAddress.Any, 0);
   IPEndPoint sender1 = new IPEndPoint(IPAddress.Parse("192.168.1.35") , 0);
   EndPoint tmpRemote = (EndPoint)(sender2);
   EndPoint tmpRemote1 = (EndPoint)(sender1);
   data = new byte[1024];
   recv = newsock.ReceiveFrom(data, ref tmpRemote);
   Console.WriteLine(Encoding.ASCII.GetString(data, 0, recv));
   string welcome = "7010";
   data = Encoding.ASCII.GetBytes(welcome);
   newsock.SendTo(data, data.Length, SocketFlags.None, tmpRemote1 );
} 


client:-
IPEndPoint ipep = new IPEndPoint(IPAddress.Parse("192.168.1.35"), 10294);
byte[] data = new byte[1024];
Socket client = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);

private void Form1_Load(object sender, EventArgs e)
        {
           client.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.MulticastTimeToLive, 10);
        }
 private void button1_Click(object sender, EventArgs e)
        {           
            string welcome = "What's your IP?";
	    data = Encoding.ASCII.GetBytes(welcome);
	    client.SendTo(data, data.Length, SocketFlags.None, ipep);
        }

 private void timer1_Tick(object sender, EventArgs e)
        {
           IPEndPoint server = new IPEndPoint(IPAddress.Any, 0);
	   EndPoint tmpRemote = (EndPoint)server;
           data = new byte[1024];
	   int recv = client.ReceiveFrom(data, ref tmpRemote);
	   this.richTextBox1.Text = Encoding.ASCII.GetString(data, 0, recv); 
        }

 private void Form1_FormClosing(object sender, FormClosingEventArgs e)
        {
            client.Close(); 
        }

AnswerRe: problem with client/server application Pin
spiritboy27-Oct-09 0:25
spiritboy27-Oct-09 0:25 
QuestionRemote Connection in Sql Server with C# Pin
anishkannan26-Oct-09 22:23
anishkannan26-Oct-09 22:23 
AnswerRe: Remote Connection in Sql Server with C# Pin
Ashfield26-Oct-09 22:46
Ashfield26-Oct-09 22:46 

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.