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

C#

 
QuestionPlacing a control in a vertically scrolled panel Pin
Member 1207484919-Jul-18 13:40
Member 1207484919-Jul-18 13:40 
AnswerRe: Placing a control in a vertically scrolled panel Pin
BillWoodruff19-Jul-18 19:41
professionalBillWoodruff19-Jul-18 19:41 
GeneralRe: Placing a control in a vertically scrolled panel Pin
Member 1207484920-Jul-18 6:12
Member 1207484920-Jul-18 6:12 
GeneralRe: Placing a control in a vertically scrolled panel Pin
Gerry Schmitz20-Jul-18 8:55
mveGerry Schmitz20-Jul-18 8:55 
GeneralRe: Placing a control in a vertically scrolled panel Pin
Member 1207484921-Jul-18 5:57
Member 1207484921-Jul-18 5:57 
GeneralRe: Placing a control in a vertically scrolled panel Pin
BillWoodruff22-Jul-18 2:45
professionalBillWoodruff22-Jul-18 2:45 
AnswerRe: Placing a control in a vertically scrolled panel Pin
Luc Pattyn22-Jul-18 10:54
sitebuilderLuc Pattyn22-Jul-18 10:54 
QuestionTCPClient to multiple systems Pin
Gopi Nath18-Jul-18 21:05
Gopi Nath18-Jul-18 21:05 
Hello Everybody,

I am writing a sender and receiver application, sender in C#,WPF and receiver in C# WinForms. In sender, will be having a list of task to do, which will be sent to multiple receivers running in multiple systems.

Here is the code in Sender

C#
for (int j = 0; j < tmpfilled.Count; j++)
{
    // some statements related to send to receiver
    ////////////
    Thread thFromReceiver = new Thread(new ThreadStart(thFromReceiverFunction));
    thFromReceiver.Start();
}   


//Body of the thFromReceiverFunction()

public void thFromReceiverFunction()
{
     // here again two thread, for read and write
     try
     {
          TcpClient client = new TcpClient();
          IPEndPoint serverEndPoint = new IPEndPoint(IPAddress.Parse(ip_address), portNo);
          client.Connect(serverEndPoint);

          Thread readThreadRec = new Thread(new ParameterizedThreadStart(readFromReceiver));
          Thread writeThreadRec = new Thread(new ParameterizedThreadStart(writeToReceiver));

          readThreadRec.Start(client);
          writeThreadRec.Start(client);
     }
     catch(Exception ex)
     {

     }


In Receiver,

// inside a thread
   TcpListener tcpListener = new TcpListener(IPAddress.Any, portNo); // same port number
   tcpListener.Start();

   while (true)
   {
        //blocks until a client has connected to the server
        TcpClient client = tcpListener.AcceptTcpClient();

        Thread readThread = new Thread(new ParameterizedThreadStart(read_thread));
        readThread.IsBackground = true;

        Thread writeThread = new Thread(new ParameterizedThreadStart(write_thread));
        writeThread.IsBackground = true;

        readThread.Start(client);
        writeThread.Start(client);

        readThread.Join();
        writeThread.Join();

        client.Close();
    }


My problem is, if I am sending to single receiver, everything is working fine. If multiple receivers are running in multiple systems, then, ipaddress which I am sending the request, shows right, but whichever the client receives the first request, all other requests are going to the same client, even though I am sending to different ipaddress (through thFromReceiverFunction() funtion).

I think I explained the issue properly, if not please let me know.

Thanks in advance.

Regards,
Gopinath.
GeneralRe: TCPClient to multiple systems Pin
Richard MacCutchan18-Jul-18 21:30
mveRichard MacCutchan18-Jul-18 21:30 
GeneralRe: TCPClient not sending messages to multiple systems Pin
Gopi Nath18-Jul-18 22:32
Gopi Nath18-Jul-18 22:32 
GeneralRe: TCPClient not sending messages to multiple systems Pin
Richard MacCutchan18-Jul-18 22:42
mveRichard MacCutchan18-Jul-18 22:42 
GeneralRe: TCPClient not sending messages to multiple systems Pin
Gopi Nath18-Jul-18 22:58
Gopi Nath18-Jul-18 22:58 
GeneralRe: TCPClient not sending messages to multiple systems Pin
Richard MacCutchan19-Jul-18 0:28
mveRichard MacCutchan19-Jul-18 0:28 
GeneralRe: TCPClient not sending messages to multiple systems Pin
Gopi Nath19-Jul-18 2:50
Gopi Nath19-Jul-18 2:50 
QuestionInvalid Resx file. Pin
Member 1207484918-Jul-18 10:33
Member 1207484918-Jul-18 10:33 
AnswerRe: Invalid Resx file. Pin
Gerry Schmitz18-Jul-18 14:02
mveGerry Schmitz18-Jul-18 14:02 
QuestionIncomprehensible errors. Any anybody help me make sense of this? Pin
Member 1207484918-Jul-18 6:49
Member 1207484918-Jul-18 6:49 
AnswerRe: Incomprehensible errors. Any anybody help me make sense of this? Pin
Gerry Schmitz18-Jul-18 13:24
mveGerry Schmitz18-Jul-18 13:24 
QuestionHow to randomly generate a number or characters in an Authorization Class file Pin
Bootzilla3317-Jul-18 4:49
Bootzilla3317-Jul-18 4:49 
AnswerRe: How to randomly generate a number or characters in an Authorization Class file Pin
Gerry Schmitz18-Jul-18 9:38
mveGerry Schmitz18-Jul-18 9:38 
GeneralRe: How to randomly generate a number or characters in an Authorization Class file Pin
Bootzilla3318-Jul-18 10:38
Bootzilla3318-Jul-18 10:38 
GeneralRe: How to randomly generate a number or characters in an Authorization Class file Pin
Gerry Schmitz18-Jul-18 13:06
mveGerry Schmitz18-Jul-18 13:06 
GeneralRe: How to randomly generate a number or characters in an Authorization Class file Pin
Mycroft Holmes18-Jul-18 14:10
professionalMycroft Holmes18-Jul-18 14:10 
QuestionThe animation of my character runs on the spot Pin
Member 1391486817-Jul-18 1:24
Member 1391486817-Jul-18 1:24 
AnswerRe: The animation of my character runs on the spot Pin
Gerry Schmitz17-Jul-18 7:37
mveGerry Schmitz17-Jul-18 7:37 

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.