473,395 Members | 1,496 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

chatting program

hi guys,
how hard is it to develop a small chatting program?
is there an example out there? I don't want to have a web browser based
application, but window application. what libraries do I need to use to
develop it?

Nov 17 '05 #1
14 2441
"Britney" <br**************@yahoo.com> a écrit dans le message de news:
ea**************@TK2MSFTNGP15.phx.gbl...
how hard is it to develop a small chatting program?
is there an example out there? I don't want to have a web browser based
application, but window application. what libraries do I need to use to
develop it?


Take a look at using sockets and TCP/IP and just send strings from one
socket to another.

Joanna

--
Joanna Carter
Consultant Software Engineer
Nov 17 '05 #2
But can you tell me how hard is it?
from 1 to 10, 1 is easiest, 10 is hardest, what do you think ? how long
will it take me to learn sockets and TCP/IP programming? and do you have
some good website about sockets and TCP/IP programming?

"Joanna Carter (TeamB)" <jo*****@nospamforme.com> wrote in message
news:ek**************@TK2MSFTNGP14.phx.gbl...
"Britney" <br**************@yahoo.com> a écrit dans le message de news:
ea**************@TK2MSFTNGP15.phx.gbl...
how hard is it to develop a small chatting program?
is there an example out there? I don't want to have a web browser based
application, but window application. what libraries do I need to use to
develop it?


Take a look at using sockets and TCP/IP and just send strings from one
socket to another.

Joanna

--
Joanna Carter
Consultant Software Engineer

Nov 17 '05 #3
It really all depends, how much exprience do you have, how fast do you
learn, how much ready-to-use code you can find.

Just try it out, it's better than whatever anybody tells you.

Britney wrote:
But can you tell me how hard is it?
from 1 to 10, 1 is easiest, 10 is hardest, what do you think ? how long
will it take me to learn sockets and TCP/IP programming? and do you have
some good website about sockets and TCP/IP programming?

"Joanna Carter (TeamB)" <jo*****@nospamforme.com> wrote in message
news:ek**************@TK2MSFTNGP14.phx.gbl...
"Britney" <br**************@yahoo.com> a 嶰rit dans le message de news:
ea**************@TK2MSFTNGP15.phx.gbl...

how hard is it to develop a small chatting program?
is there an example out there? I don't want to have a web browser based
application, but window application. what libraries do I need to use to
develop it?


Take a look at using sockets and TCP/IP and just send strings from one
socket to another.

Joanna

--
Joanna Carter
Consultant Software Engineer


Nov 17 '05 #4

well... can someone provide me an example to create chatting program? or
tell me how does chatting work with TCP/IP and socket? I don't know how
the process go. To my understanding, socket is like a tunnel that connects
one computer to the other computer, a socket is defined by IP address+port
number. that's all I know.

"Jianwei Sun" <js***********@gmail.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
It really all depends, how much exprience do you have, how fast do you
learn, how much ready-to-use code you can find.

Just try it out, it's better than whatever anybody tells you.

Britney wrote:
But can you tell me how hard is it?
from 1 to 10, 1 is easiest, 10 is hardest, what do you think ? how long
will it take me to learn sockets and TCP/IP programming? and do you have
some good website about sockets and TCP/IP programming?

"Joanna Carter (TeamB)" <jo*****@nospamforme.com> wrote in message
news:ek**************@TK2MSFTNGP14.phx.gbl...
"Britney" <br**************@yahoo.com> a ?rit dans le message de news:
ea**************@TK2MSFTNGP15.phx.gbl...
how hard is it to develop a small chatting program?
is there an example out there? I don't want to have a web browser based
application, but window application. what libraries do I need to use to
develop it?

Take a look at using sockets and TCP/IP and just send strings from one
socket to another.

Joanna

--
Joanna Carter
Consultant Software Engineer



Nov 17 '05 #5
using System;
using System.Net;
using System.Net.Sockets;
using System.Text;
class SimpleTcpSrvr
{
public static void Main()
{
int recv;
byte[] data = new byte[1024];
IPEndPoint ipep = new IPEndPoint(IPAddress.Any,
9050);
Socket newsock = new
Socket(AddressFamily.InterNetwork,
SocketType.Stream, ProtocolType.Tcp);
newsock.Bind(ipep);
newsock.Listen(10);
Console.WriteLine("Waiting for a client...");
Socket client = newsock.Accept();
IPEndPoint clientep =
(IPEndPoint)client.RemoteEndPoint;
Console.WriteLine("Connected with {0} at port {1}",
clientep.Address, clientep.Port);

string welcome = "Welcome to my test server";
data = Encoding.ASCII.GetBytes(welcome);
client.Send(data, data.Length,
SocketFlags.None);
while(true)
{
data = new byte[1024];
recv = client.Receive(data);
if (recv == 0)
break;

Console.WriteLine(
Encoding.ASCII.GetString(data, 0, recv));
client.Send(data, recv, SocketFlags.None);
}
Console.WriteLine("Disconnected from {0}",
clientep.Address);
client.Close();
newsock.Close();
}
}class SimpleTcpClient
{
public static void Main()
{
byte[] data = new byte[1024];
string input, stringData;
IPEndPoint ipep = new IPEndPoint(
IPAddress.Parse("127.0.0.1"), 9050);
Socket server = new Socket(AddressFamily.InterNetwork,
SocketType.Stream, ProtocolType.Tcp);
try
{
server.Connect(ipep);
} catch (SocketException e)
{
Console.WriteLine("Unable to connect to server.");
Console.WriteLine(e.ToString());
return;
}
int recv = server.Receive(data);
stringData = Encoding.ASCII.GetString(data, 0, recv);
Console.WriteLine(stringData);
while(true)
{
input = Console.ReadLine();
if (input == "exit")
break;
server.Send(Encoding.ASCII.GetBytes(input));
data = new byte[1024];
recv = server.Receive(data);
stringData = Encoding.ASCII.GetString(data, 0, recv);
Console.WriteLine(stringData);
}
Console.WriteLine("Disconnecting from server...");
server.Shutdown(SocketShutdown.Both);
server.Close();
}
}Lifted from "C# Network Programming" by Richard Blum. If it's useful to
you, consider buying the book.-- Regards,Tim
HaughtonAgitekhttp://agitek.co.ukhttp://blogitek.com/timhaughton
Nov 17 '05 #6
> }Lifted from "C# Network Programming" by Richard Blum. If it's useful to
you, consider buying the book.-- Regards,Tim
HaughtonAgitekhttp://agitek.co.ukhttp://blogitek.com/timhaughton


Weird formatting problem!

--
Regards,

Tim Haughton

Agitek
http://agitek.co.uk
http://blogitek.com/timhaughton
Nov 17 '05 #7
Tim,
I got this error when I run it. any idea why?
I opened port 9050 in the firewall, but I still got this error.
Unable to connect to server.
System.Net.Sockets.SocketException: No connection could be made because the
targ
et machine actively refused it
at System.Net.Sockets.Socket.Connect(EndPoint remoteEP)
at SimpleTcpClient.Main() in c:\documents and settings\brit\m
y documents\visual studio projects\consoleapplication5\class1.cs:line 60
Press any key to continue
"Tim Haughton" <ti*********@gmail.com> wrote in message
news:Q4********************@fe11.news.easynews.com ...
using System;
using System.Net;
using System.Net.Sockets;
using System.Text;
class SimpleTcpSrvr
{
public static void Main()
{
int recv;
byte[] data = new byte[1024];
IPEndPoint ipep = new IPEndPoint(IPAddress.Any,
9050);
Socket newsock = new
Socket(AddressFamily.InterNetwork,
SocketType.Stream, ProtocolType.Tcp);
newsock.Bind(ipep);
newsock.Listen(10);
Console.WriteLine("Waiting for a client...");
Socket client = newsock.Accept();
IPEndPoint clientep =
(IPEndPoint)client.RemoteEndPoint;
Console.WriteLine("Connected with {0} at port {1}",
clientep.Address, clientep.Port);

string welcome = "Welcome to my test server";
data = Encoding.ASCII.GetBytes(welcome);
client.Send(data, data.Length,
SocketFlags.None);
while(true)
{
data = new byte[1024];
recv = client.Receive(data);
if (recv == 0)
break;

Console.WriteLine(
Encoding.ASCII.GetString(data, 0, recv));
client.Send(data, recv, SocketFlags.None);
}
Console.WriteLine("Disconnected from {0}",
clientep.Address);
client.Close();
newsock.Close();
}
}class SimpleTcpClient
{
public static void Main()
{
byte[] data = new byte[1024];
string input, stringData;
IPEndPoint ipep = new IPEndPoint(
IPAddress.Parse("127.0.0.1"), 9050);
Socket server = new Socket(AddressFamily.InterNetwork,
SocketType.Stream, ProtocolType.Tcp);
try
{
server.Connect(ipep);
} catch (SocketException e)
{
Console.WriteLine("Unable to connect to server.");
Console.WriteLine(e.ToString());
return;
}
int recv = server.Receive(data);
stringData = Encoding.ASCII.GetString(data, 0, recv);
Console.WriteLine(stringData);
while(true)
{
input = Console.ReadLine();
if (input == "exit")
break;
server.Send(Encoding.ASCII.GetBytes(input));
data = new byte[1024];
recv = server.Receive(data);
stringData = Encoding.ASCII.GetString(data, 0, recv);
Console.WriteLine(stringData);
}
Console.WriteLine("Disconnecting from server...");
server.Shutdown(SocketShutdown.Both);
server.Close();
}
}Lifted from "C# Network Programming" by Richard Blum. If it's useful to
you, consider buying the book.-- Regards,Tim
HaughtonAgitekhttp://agitek.co.ukhttp://blogitek.com/timhaughton

Nov 17 '05 #8
..net remoting is also a viable issue. It allows you to pass objects and
such without worrying about the serialization issue that sockets create

Nov 17 '05 #9
Ron
"Britney" <br**************@yahoo.com> wrote in message
news:Ob*************@TK2MSFTNGP11.phx.gbl...
Tim,
I got this error when I run it. any idea why?
I opened port 9050 in the firewall, but I still got this error.
Unable to connect to server.
System.Net.Sockets.SocketException: No connection could be made because
the targ
et machine actively refused it
at System.Net.Sockets.Socket.Connect(EndPoint remoteEP)
at SimpleTcpClient.Main() in c:\documents and settings\brit\m
y documents\visual studio projects\consoleapplication5\class1.cs:line 60
Press any key to continue

<snip>

Have you set the SocketPermissions? If you don't, this will prevent you from
connecting. (on Windows 2000 at least).

HTH
Ron.
Nov 17 '05 #10
i'm using win xp sp2
how do I set permission?
"Ron" <no***@nowhere.com> wrote in message
news:O$**************@TK2MSFTNGP09.phx.gbl...
"Britney" <br**************@yahoo.com> wrote in message
news:Ob*************@TK2MSFTNGP11.phx.gbl...
Tim,
I got this error when I run it. any idea why?
I opened port 9050 in the firewall, but I still got this error.
Unable to connect to server.
System.Net.Sockets.SocketException: No connection could be made because
the targ
et machine actively refused it
at System.Net.Sockets.Socket.Connect(EndPoint remoteEP)
at SimpleTcpClient.Main() in c:\documents and settings\brit\m
y documents\visual studio projects\consoleapplication5\class1.cs:line 60
Press any key to continue

<snip>

Have you set the SocketPermissions? If you don't, this will prevent you
from connecting. (on Windows 2000 at least).

HTH
Ron.

Nov 17 '05 #11
Hi Britney,
I made a simple C# chat application using .net and remoting as a little
project to help me understand remoting better. Remoting is pretty easy to
use and very powerful, maybe the code I wrote would be of some help to you to
get started.

Check out http://www.markdawson.org/software and scroll to the bottom.

Hope that helps
Mark R Dawson
http://www.markdawson.org

"Britney" wrote:
hi guys,
how hard is it to develop a small chatting program?
is there an example out there? I don't want to have a web browser based
application, but window application. what libraries do I need to use to
develop it?

Nov 17 '05 #12
thank you.
This helps a lot!!!

"Mark R. Dawson" <Ma*********@discussions.microsoft.com> wrote in message
news:D8**********************************@microsof t.com...
Hi Britney,
I made a simple C# chat application using .net and remoting as a little
project to help me understand remoting better. Remoting is pretty easy to
use and very powerful, maybe the code I wrote would be of some help to you
to
get started.

Check out http://www.markdawson.org/software and scroll to the bottom.

Hope that helps
Mark R Dawson
http://www.markdawson.org

"Britney" wrote:
hi guys,
how hard is it to develop a small chatting program?
is there an example out there? I don't want to have a web browser based
application, but window application. what libraries do I need to use to
develop it?

Nov 17 '05 #13
Ron
"Britney" <br**************@yahoo.com> wrote in message
news:ea**************@TK2MSFTNGP12.phx.gbl...
i'm using win xp sp2
how do I set permission?

<snip>
Look at the MSDN/Visual Studio .NET Sockets help. There are examples of a
simple Socket Client and Server, and Socket Permissions. That should give
you all you need to know about Sockets.

Ron.
Nov 17 '05 #14
Britney -

Most likely your connection is getting blocked by the XP SP2
firewall feature. You can check that by looking at your network
connection properties, and clicking the Advanced tab. Just list port
9050 (or whatever port you decide to use in the code) in the Exceptions
list.

BTW - the example provided is pretty bare-bones and is subject to
errors if your network is busy. There are better examples that do
proper error checking later on in the book samples. You can freely
download the other sample code from the Sybex web site listed in my
sig. Good luck, and happy network programming!

Rich Blum - Author
"C# Network Programming" (Sybex)
http://www.sybex.com/sybexbooks.nsf/Booklist/4176

Britney wrote:
i'm using win xp sp2
how do I set permission?
"Ron" <no***@nowhere.com> wrote in message
news:O$**************@TK2MSFTNGP09.phx.gbl...
"Britney" <br**************@yahoo.com> wrote in message
news:Ob*************@TK2MSFTNGP11.phx.gbl...
Tim,
I got this error when I run it. any idea why?
I opened port 9050 in the firewall, but I still got this error.
Unable to connect to server.
System.Net.Sockets.SocketException: No connection could be made because
the targ
et machine actively refused it
at System.Net.Sockets.Socket.Connect(EndPoint remoteEP)
at SimpleTcpClient.Main() in c:\documents and settings\brit\m
y documents\visual studio projects\consoleapplication5\class1.cs:line 60
Press any key to continue

<snip>

Have you set the SocketPermissions? If you don't, this will prevent you
from connecting. (on Windows 2000 at least).

HTH
Ron.


Nov 17 '05 #15

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Sameer | last post by:
Hello, I am new to XML and I want to know how can I improve my Chatting software written in Java using XML? In chatting software there is a lot of data transfer along with formatting infomation....
2
by: Reny | last post by:
Can any one guide me on creating a chatting app with asp.net /vb.net
3
by: narasimha26 | last post by:
How to do online chatting in asp.net1.1 and sqlserver2000
7
by: kpranjan1 | last post by:
i am getting exception like this--- 1. " nsresult: "0x804b000f (<unknown>)" location: "JS frame :: http://localhost:8080/supportnow/jsLibrary/Ajax.js :: getChatText :: line 149" data: no] ...
1
by: Ragava | last post by:
I want to know the How the Chatting Programs while Sending Messages .. Can any one Brief me about that...................
1
by: s14m27 | last post by:
hi.... Could anyone help me in creating a chatting application in Asp.Net. Is it possible do so by not saving the messages in database..... Thankyou
2
by: NagarajanS | last post by:
Hi, i want to develope one simple intranet chatting application using java.How to do that?is any open source is available for this? Othewise Can you give me idea how to develope the chatting...
1
djchynna
by: djchynna | last post by:
please can somebody help me?? i want to know a simple codes of a private chatting.. i'll used it as my guide for my project.. chatting!!!
1
by: Chetana | last post by:
Hello , I have implemented one social networking site using asp.net and I want to integrate the chatting in site. So if u have any idea or any reference link about that please let us know. ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.