Click here to Skip to main content
15,887,337 members
Home / Discussions / C#
   

C#

 
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 
GeneralRe: Remote Connection in Sql Server with C# Pin
spiritboy27-Oct-09 0:26
spiritboy27-Oct-09 0:26 
QuestionHow to select rows from a Dataset Pin
Nekkantidivya26-Oct-09 20:52
Nekkantidivya26-Oct-09 20:52 
AnswerRe: How to select rows from a Dataset Pin
Vikram A Punathambekar26-Oct-09 22:47
Vikram A Punathambekar26-Oct-09 22:47 
AnswerRe: How to select rows from a Dataset Pin
Adam R Harris27-Oct-09 10:04
Adam R Harris27-Oct-09 10:04 
QuestionLoad Dll in Runtime Pin
savitri26-Oct-09 20:14
savitri26-Oct-09 20:14 
QuestionTesting tools available for Testing the functionality Pin
support@Acsonnet.com26-Oct-09 20:05
support@Acsonnet.com26-Oct-09 20:05 
AnswerRe: Testing tools available for Testing the functionality Pin
N a v a n e e t h26-Oct-09 20:37
N a v a n e e t h26-Oct-09 20:37 
Questionremote desktop.... Pin
v_neil8726-Oct-09 19:46
v_neil8726-Oct-09 19:46 
AnswerRe: remote desktop.... Pin
Vimalsoft(Pty) Ltd26-Oct-09 20:31
professionalVimalsoft(Pty) Ltd26-Oct-09 20:31 
AnswerRe: remote desktop.... Pin
Pete O'Hanlon26-Oct-09 22:51
mvePete O'Hanlon26-Oct-09 22:51 
QuestionHow to set formatted html to the clipboard Pin
hirajhil26-Oct-09 19:18
hirajhil26-Oct-09 19:18 
QuestionWhich book learning C # better? Pin
miss YY26-Oct-09 18:06
miss YY26-Oct-09 18:06 
AnswerRe: Which book learning C # better? Pin
Richard MacCutchan26-Oct-09 23:07
mveRichard MacCutchan26-Oct-09 23:07 
GeneralRe: Which book learning C # better? Pin
miss YY27-Oct-09 17:29
miss YY27-Oct-09 17:29 

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.