8

I want to make a very simple c++ instant messenger for lan networks and internet (direct IP connect). I know little about sockets. I searched the internet, but nothing really helped. I would someone to suggest a howto/tutorial/guide. I just want to send and receive messages (in a console window, I'll create the gui later). I want it to be for both Linux and Windows. Thanks in advance!

int3
  • 12,861
  • 8
  • 51
  • 80
  • None of the answers really helped. Thanks though. I tried Boost.Asio (it didn't compile), Qt (it works, but I do not know much about it) and the "codeproject.com" example but many problems occured. Can anybody suggest anything else? –  Dec 09 '09 at 11:23
  • 1
    what compiler/version did you use? which Boost release did you try? what were some of the "many problems" you had with Qt? will anything but a complete solution breastfed satisfy you? – just somebody Dec 17 '09 at 19:12
  • @just somebody: I didn't say that I have problems with Qt, but with the codeproject example. I used the GNU compiler for boost, but people also confirmed that there are problems with it. –  Jan 09 '10 at 13:41

4 Answers4

12

Checkout Boost.Asio. It's portable, and it's also got an example that implements a simple chat.

Björn Pollex
  • 75,346
  • 28
  • 201
  • 283
  • Thanks, I'll try that and post if I have any questions. –  Nov 30 '09 at 13:51
  • I cannot find where to download the libraries and the headers. –  Nov 30 '09 at 13:55
  • Download at http://www.boost.org/users/download/. You will have to do some reading to get this working though. – Björn Pollex Nov 30 '09 at 14:06
  • I get a linker error while trying to compile the example code in dev-c++: [Linker error] undefined reference to `_Unwind_Resume' Does anybody know how to fix it? –  Nov 30 '09 at 15:45
  • from my experience, examples (of any boost libraries i've tried) don't always compile. try a different example file. or which example it is. or something. – just somebody Nov 30 '09 at 16:14
  • It is the only chat client example. I tried linking many different libs, but nothing worked. –  Nov 30 '09 at 16:28
3

check out Boost.ASIO

just somebody
  • 18,602
  • 6
  • 51
  • 60
3

There's some source code here for a C/S chat application that you could probably use to get started.

Mas.

Example Code

miPwn
  • 1,166
  • 1
  • 13
  • 29
  • I tried that earlier, but there is a header file I couldn't find. –  Nov 30 '09 at 13:50
  • @MaSuGaNa - I was wrong, it was a similar project of the same author which used a header I couldn't find. Is this only for windows, or I misunderstood? –  Nov 30 '09 at 14:04
  • The code looks easy enough to modify for cross platform use. If you want something already written I'd go with Boost. – miPwn Nov 30 '09 at 14:26
2

Use boost, cross platform, under the link, straight forward example for client-server chat.

bua
  • 4,761
  • 1
  • 26
  • 32