comp.lang.ada
 help / color / mirror / Atom feed
* Ada Chat Program
@ 2004-09-17 17:13 Stephen Z
  2004-09-17 18:18 ` Bernd Specht
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Stephen Z @ 2004-09-17 17:13 UTC (permalink / raw)


I am trying to write a simple chat program with Ada. I am using the
sockets package. I am trying to input a string and parse each
character and send them each individually. If anyone can help me with
this, I would greatly appreciate it.



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Ada Chat Program
  2004-09-17 17:13 Ada Chat Program Stephen Z
@ 2004-09-17 18:18 ` Bernd Specht
  2004-09-17 21:20   ` Martin Dowie
  2004-09-18 14:09 ` Pascal Obry
  2004-09-27  7:46 ` Jacob Sparre Andersen
  2 siblings, 1 reply; 8+ messages in thread
From: Bernd Specht @ 2004-09-17 18:18 UTC (permalink / raw)


eaker1236@yahoo.com (Stephen Z) wrote in news:de98c113.0409170913.2e016a86
@posting.google.com:

> I am trying to write a simple chat program with Ada. I am using the
> sockets package. I am trying to input a string and parse each
> character and send them each individually. If anyone can help me with
> this, I would greatly appreciate it.

Can you be more specific? What kind of help do you need? Do you want use tcp 
or udp? Which OS? Console-app or gui?

And especially:

> each character and send them each individually.

Why this? This will produce a lot of unnecessary network traffic.



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Ada Chat Program
  2004-09-17 18:18 ` Bernd Specht
@ 2004-09-17 21:20   ` Martin Dowie
  2004-09-18 16:15     ` Stephen Z
  2004-09-18 19:05     ` Bernd Specht
  0 siblings, 2 replies; 8+ messages in thread
From: Martin Dowie @ 2004-09-17 21:20 UTC (permalink / raw)


"Bernd Specht" <Bernd.Specht@gmx.com> wrote in message
>> each character and send them each individually.
>
> Why this? This will produce a lot of unnecessary network traffic.

It's a 'chat' program - I expect it is so the user at the other end can see 
characters as they are typed - a bit like the old "VAX phone"... 





^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Ada Chat Program
  2004-09-17 17:13 Ada Chat Program Stephen Z
  2004-09-17 18:18 ` Bernd Specht
@ 2004-09-18 14:09 ` Pascal Obry
  2004-09-27  7:46 ` Jacob Sparre Andersen
  2 siblings, 0 replies; 8+ messages in thread
From: Pascal Obry @ 2004-09-18 14:09 UTC (permalink / raw)



eaker1236@yahoo.com (Stephen Z) writes:

> I am trying to write a simple chat program with Ada. I am using the
> sockets package. I am trying to input a string and parse each
> character and send them each individually. If anyone can help me with
> this, I would greatly appreciate it.

This is trivial to do with GLADE. Doing it using low-level sockets is possible
but much harder than using the Ada Distributed Annex. If by chance your
compiler is GNAT try using GLADE.

Pascal.

-- 

--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|              http://www.obry.org
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Ada Chat Program
  2004-09-17 21:20   ` Martin Dowie
@ 2004-09-18 16:15     ` Stephen Z
  2004-09-18 19:10       ` Bernd Specht
  2004-09-18 19:05     ` Bernd Specht
  1 sibling, 1 reply; 8+ messages in thread
From: Stephen Z @ 2004-09-18 16:15 UTC (permalink / raw)


"Martin Dowie" <martin.dowie@btopenworld.com> wrote in message news:<cifket$6ou$1@hercules.btinternet.com>...
> "Bernd Specht" <Bernd.Specht@gmx.com> wrote in message
> >> each character and send them each individually.
> >
> > Why this? This will produce a lot of unnecessary network traffic.
> 
> It's a 'chat' program - I expect it is so the user at the other end can see 
> characters as they are typed - a bit like the old "VAX phone"...

I very new to programming in Ada and I am not sure about the best way
to write this program. I was thinking that character-by-character
would be easier simply because I don't necessarily know the length of
the strings I want to send. If you could give some advice about
sending strings I am should that would be more efficient. Also, if you
could point me to some good websites or books I would appreciate it
greatly.



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Ada Chat Program
  2004-09-17 21:20   ` Martin Dowie
  2004-09-18 16:15     ` Stephen Z
@ 2004-09-18 19:05     ` Bernd Specht
  1 sibling, 0 replies; 8+ messages in thread
From: Bernd Specht @ 2004-09-18 19:05 UTC (permalink / raw)


"Martin Dowie" <martin.dowie@btopenworld.com> wrote in
news:cifket$6ou$1@hercules.btinternet.com: 

> "Bernd Specht" <Bernd.Specht@gmx.com> wrote in message
>>> each character and send them each individually.
>>
>> Why this? This will produce a lot of unnecessary network traffic.
> 
> It's a 'chat' program - I expect it is so the user at the other end can
> see characters as they are typed - a bit like the old "VAX phone"... 
> 


Ok, this could be a reason. But, Stephen wrote: 

> am trying to input a string and parse each
> character and send them each individually. 

So if he inputs a string, why  not send the string directly. Why send it 
byte by byte?




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Ada Chat Program
  2004-09-18 16:15     ` Stephen Z
@ 2004-09-18 19:10       ` Bernd Specht
  0 siblings, 0 replies; 8+ messages in thread
From: Bernd Specht @ 2004-09-18 19:10 UTC (permalink / raw)


eaker1236@yahoo.com (Stephen Z) wrote in
news:de98c113.0409180815.560719b1@posting.google.com: 

> "Martin Dowie" <martin.dowie@btopenworld.com> wrote in message
> news:<cifket$6ou$1@hercules.btinternet.com>... 
>> "Bernd Specht" <Bernd.Specht@gmx.com> wrote in message
>> >> each character and send them each individually.
>> >
>> > Why this? This will produce a lot of unnecessary network traffic.
>> 
>> It's a 'chat' program - I expect it is so the user at the other end
>> can see characters as they are typed - a bit like the old "VAX
>> phone"... 
> 
> I very new to programming in Ada and I am not sure about the best way
> to write this program. I was thinking that character-by-character
> would be easier simply because I don't necessarily know the length of
> the strings I want to send. If you could give some advice about
> sending strings I am should that would be more efficient. Also, if you
> could point me to some good websites or books I would appreciate it
> greatly.


What about the other questions? OS? Protocol? GUI/Console app? What 
environment (firewall, NAT, ...)?

Maybe I can send you some example code (if it is for windows).



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Ada Chat Program
  2004-09-17 17:13 Ada Chat Program Stephen Z
  2004-09-17 18:18 ` Bernd Specht
  2004-09-18 14:09 ` Pascal Obry
@ 2004-09-27  7:46 ` Jacob Sparre Andersen
  2 siblings, 0 replies; 8+ messages in thread
From: Jacob Sparre Andersen @ 2004-09-27  7:46 UTC (permalink / raw)


Stephen Z. wrote:

> I am trying to write a simple chat program with Ada. I am using the
> sockets package. I am trying to input a string and parse each
> character and send them each individually. If anyone can help me
> with this, I would greatly appreciate it.

I think the sockets package has a plain Put_Line procedure that you
can use.  In
<http://www.nbi.dk/%7Esparre/temp/diffusion_confusion-20020902.tar.gz>
you can find some code I wrote with a friend using the sockets
package.  I hope it is sufficient to give you an idea of how you can
use the sockets package on a line-by-line basis.  Once you have set up
the connection, there isn't much difference between Ada.Text_IO and
Sockets.

Jacob

PS: I like `talk` style chat programs much more than ICQ style.  To me
    ICQ seems just like my e-mail program, only with the ability to
    see who is awake at the moment, whereas `talk` is proper chatting.
-- 
Growing older is compulsory. Growing up isn't.




^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2004-09-27  7:46 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-17 17:13 Ada Chat Program Stephen Z
2004-09-17 18:18 ` Bernd Specht
2004-09-17 21:20   ` Martin Dowie
2004-09-18 16:15     ` Stephen Z
2004-09-18 19:10       ` Bernd Specht
2004-09-18 19:05     ` Bernd Specht
2004-09-18 14:09 ` Pascal Obry
2004-09-27  7:46 ` Jacob Sparre Andersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox