Click here to Skip to main content
15,891,513 members
Home / Discussions / C#
   

C#

 
QuestionTCP Comm. <Data handling help needed> Pin
Member 1168908120-May-15 16:07
Member 1168908120-May-15 16:07 
AnswerRe: TCP Comm. <Data handling help needed> Pin
Richard MacCutchan20-May-15 21:29
mveRichard MacCutchan20-May-15 21:29 
QuestionRetreive blob as text SQLite Pin
DPaul199420-May-15 7:51
DPaul199420-May-15 7:51 
AnswerRe: Retreive blob as text SQLite PinPopular
Richard Deeming20-May-15 8:13
mveRichard Deeming20-May-15 8:13 
GeneralRe: Retreive blob as text SQLite Pin
DPaul199420-May-15 8:20
DPaul199420-May-15 8:20 
Questionpropeties in consuming class Pin
Cianide20-May-15 3:49
Cianide20-May-15 3:49 
AnswerRe: propeties in consuming class Pin
Sascha Lefèvre20-May-15 4:03
professionalSascha Lefèvre20-May-15 4:03 
Questionserver and client Pin
Nick196120-May-15 2:15
Nick196120-May-15 2:15 
hi to all and sorry for my bad english (im Italian).
i have a code (c#) for chat server and client using NetworksApi library. server and client works good but only in local (192.168.1.--).
what i would is the same operation but with public Ip (internet for far PC).
I tried putting the public IP and port number but nothing works.
here is my code for SERVER :

C#
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using NetworksApi.TCP.SERVER;
using System.IO;
using System.Net;

namespace AdvanceServer
{
    public delegate void UpdateChatLog(string txt);
    public delegate void UpdateListBox(ListBox box,string value, bool Remove);

    public partial class Form1 : Form
    {
        Server server;
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            server = new Server("192.168.1.6","90");
            server.OnClientConnected += new OnConnectedDelegate(server_OnClientConnected);
            server.OnClientDisconnected += new OnDisconnectedDelegate(server_OnClientDisconnected);
            server.OnDataReceived += new OnReceivedDelegate(server_OnDataReceived);
            server.OnServerError += new OnErrorDelegate(server_OnServerError);
            server.Start();
        }


Here is the code for CLIENT :
C#
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using NetworksApi.TCP.CLIENT;
using System.IO;
using System.Net;

namespace AdvancedClient
{
    public delegate void UpdateText(string txt);
    public partial class Form1 : Form
    {
        Client client;
        public Form1()
        {
            InitializeComponent();
        }
        private void Form1_Load(object sender, EventArgs e)
        {

        }
        private void ChangeTextBox(string txt)
        { 
            if (textBox1.InvokeRequired)
            {
                Invoke(new UpdateText(ChangeTextBox), new object[] { txt });
            }
            else
            {
                textBox1.Text += txt + "\r\n";
            }
        }
        private void button3_Click(object sender, EventArgs e)
        {
            if (textBox3.Text != "" && textBox4.Text != "" && textBox5.Text != "")
            {
                client = new Client();
                client.ClientName = textBox4.Text;
                client.ServerIp = textBox3.Text;
                client.ServerPort = textBox5.Text;

                client.OnClientConnected += new OnClientConnectedDelegate(client_OnClientConnected);
                client.OnClientConnecting += new OnClientConnectingDelegate(client_OnClientConnecting);
                client.OnClientDisconnected += new OnClientDisconnectedDelegate(client_OnClientDisconnected);
                client.OnClientError += new OnClientErrorDelegate(clien_OnClientError);
                client.OnClientFileSending += new OnClientFileSendingDelegate(client_OnClientFileSending);
                client.OnDataReceived += new OnClientReceivedDelegate(client_OnDataReceived);

                client.Connect();
            }
            else
            {
                MessageBox.Show("E' obbligatorio completare tutti i campi");
            }
        }


anybody can help me ?
Thanks, Nick.
AnswerRe: server and client Pin
Richard MacCutchan20-May-15 2:35
mveRichard MacCutchan20-May-15 2:35 
GeneralRe: server and client Pin
Nick196120-May-15 2:48
Nick196120-May-15 2:48 
GeneralRe: server and client Pin
Nick196120-May-15 2:51
Nick196120-May-15 2:51 
GeneralRe: server and client Pin
Richard MacCutchan20-May-15 3:07
mveRichard MacCutchan20-May-15 3:07 
GeneralRe: server and client Pin
Nick196120-May-15 12:22
Nick196120-May-15 12:22 
QuestionIIS stop the webservice application when I migrated 1.1 to 4.5 framework Pin
Narayan Mitra20-May-15 1:19
Narayan Mitra20-May-15 1:19 
Questionhow retrieve image from database Binary Format Pin
Member 1168949020-May-15 0:41
Member 1168949020-May-15 0:41 
AnswerRe: how retrieve image from database Binary Format Pin
Herman<T>.Instance20-May-15 0:52
Herman<T>.Instance20-May-15 0:52 
AnswerRe: how retrieve image from database Binary Format Pin
Sascha Lefèvre20-May-15 0:55
professionalSascha Lefèvre20-May-15 0:55 
Questionclosing an application before it begins Pin
DannyGroff19-May-15 8:30
DannyGroff19-May-15 8:30 
AnswerRe: closing an application before it begins Pin
OriginalGriff19-May-15 8:57
mveOriginalGriff19-May-15 8:57 
GeneralRe: closing an application before it begins Pin
Sascha Lefèvre19-May-15 10:01
professionalSascha Lefèvre19-May-15 10:01 
GeneralRe: closing an application before it begins Pin
OriginalGriff19-May-15 10:07
mveOriginalGriff19-May-15 10:07 
GeneralRe: closing an application before it begins Pin
Sascha Lefèvre19-May-15 11:41
professionalSascha Lefèvre19-May-15 11:41 
GeneralRe: closing an application before it begins Pin
DannyGroff19-May-15 10:07
DannyGroff19-May-15 10:07 
GeneralRe: closing an application before it begins Pin
OriginalGriff19-May-15 10:35
mveOriginalGriff19-May-15 10:35 
GeneralRe: closing an application before it begins Pin
Mycroft Holmes19-May-15 14:03
professionalMycroft Holmes19-May-15 14:03 

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.