I'm working on a tcp sever that recieves a message plus font, font size, text color, and background color, and direction to scroll. I have all of this working now, but I don't have the sever being able to recieve new messages and so forth. I need to get the sever to be able to recieve updates. I was told to use multithreading, but I don't know where to begin on this. I would appreicate any help given.

Sincerely yours;


sever code:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Net.Sockets;
using System.Net;
using System.Threading;
using System.Net.NetworkInformation;

namespace iSignSever
    public partial class Form1 : Form

        public Form1()

        private void ListenButton_Click(object sender, EventArgs e)
            string port = PortTextBox.Text;
            int myParsedInt = Int32.Parse(port);
            Socket listenSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
            listenSocket.Bind(new IPEndPoint(IPAddress.Any, myParsedInt));

            Socket connection = listenSocket.Accept();

            byte[] buffer = new byte[1024];

            string text = System.Text.ASCIIEncoding.ASCII.GetString(buffer);

            string[] data = text.Split(':');

             label1.Text = data[0];

            string fColor = data[1];
            fColor = fColor.Substring(7);
            fColor = fColor.Substring(0, fColor.Length - 1);
            string bColor = data[2];
            bColor = bColor.Substring(7);
            bColor = bColor.Substring(0, bColor.Length - 1);
            string directoin = data[3];
            string fszie = data[4];
            string[] data2 = fszie.Split('=');
            string fsize2 = data2[1];
            float fontSize = System.Convert.ToSingle(fsize2);
            string fontName = data[6];
            fontName = fontName.Substring(0, fontName.Length - 1);
            string[] data3 = fontName.Split('=');
            string fontName2 = data3[1];

            label1.ForeColor = Color.FromName(fColor);
            label1.BackColor = Color.FromName(bColor);
            label1.Font = new Font(fontName2, fontSize);                
            if (directoin == "left")
             timer1.Enabled = true;
                timer2.Enabled = true;

        private void closeToolStripMenuItem_Click(object sender, EventArgs e)

        private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
            MessageBox.Show("This is the CSCI 360 iSign Sever Application.  Worked on by Team 5", "iSign Sever About");

        private void scroll()
           label1.Text = label1.Text.Substring(1) + label1.Text[0];

        private void scroll2()
            int temp = label1.Text.Length - 1;
            label1.Text = label1.Text[temp] + label1.Text.Substring(0, temp);

        private void timer1_Tick_1(object sender, EventArgs e)

        private void timer2_Tick(object sender, EventArgs e)

        private void displayIpButton_Click(object sender, EventArgs e)
            StringBuilder sb = new StringBuilder();

            // Get a list of all network interfaces (usually one per network card, dialup, and VPN connection)
            NetworkInterface[] networkInterfaces = NetworkInterface.GetAllNetworkInterfaces();

            foreach (NetworkInterface network in networkInterfaces)
                // Read the IP configuration for each network
                IPInterfaceProperties properties = network.GetIPProperties();

                // Each network interface may have multiple IP addresses
                foreach (IPAddressInformation address in properties.UnicastAddresses)
                    // We're only interested in IPv4 addresses for now
                    if (address.Address.AddressFamily != AddressFamily.InterNetwork)

                    // Ignore loopback addresses (e.g.,
                    if (IPAddress.IsLoopback(address.Address))

                    sb.AppendLine(address.Address.ToString() + " (" + network.Name + ")");

6 Years
Discussion Span
Last Post by jdm

I will check it and let you know if I got it to work or not.

Thanks for the link.


This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.