Hello everyone,

Ive spent the last month or so trying to learn a bit about Winsock, and i thought i would share what ive made so far with the board, its just a simple chat server/client i made for my little 3 pc home network, nowt fancy!

Its by no means finished and i'm probably doing loads of things horribly wrong, any feedback/tips/points in the right direction, would be most welcome. There are lots of things i know i could be doing better, for instance i think im sending far more data about than i need to (i send a font face name string everytime somebody sends text!) ...also im not using send *i think* in the correct way for WSAAsyncSelect but like i said this is just a learning test for now.

Its been programmed in a way in which the server/client are in the same source code, SERVER_FLAG in DATA.ASM and RSRC.RC should be set to 1 to assemble server and 0 for client. This is probably a sloppy way of doing it, but it speeds up the coding and keeps everything "together" ...well.....i like it.

I've just assembled the client to connect to my current IP Address! (note this will change, so this wont work for long) as a means of testing it (its only ever been tested on my local network with no more than 3 pc's ...so this should be interesting!) so if you dare come and test it out and have a chat with me!

I'll start the server running now, this thing has NO security features, so this is probably a REALLY bad idea....but never mind...*gulp*

Feel free to do whatever you want with the source code....hope this helps somebody out there..

Cheers Lennon.

P.S If you wonder who the hell Pauly is when you try out the chat/look at the source, its my real name.

EDIT - i deleted the old attachment to save a bit of space.
Posted on 2003-05-02 20:13:37 by Lennon
oh well test over, my ISP just disconnected me....and not one person even logged on :(

...it was a bit late at night...your probably all in bed!

To test it out for yourself you will have to assemble the server, change szConnectIP in the DATA.ASM file to something appropriate (local host maybe - 127.0.0.1)

and then assemble the Client.

Cheers Lennon.
Posted on 2003-05-02 21:08:46 by Lennon
Ok, i thought i might aswell assemble a server and client for you ready to test, client connects to local host. Also just rememberd that i have added some things to my WINDOWS.INC that other people might not have, so ive included it in the new attachment.

Cheers Lennon.
Posted on 2003-05-03 03:39:59 by Lennon
Come on, all those downloads and no comments, questions...anything? IS THERE ANYBODY OUT THERE...
Posted on 2003-05-04 09:26:48 by Lennon
Another way with the send-function would perhaps be setting FD_WRITE with WSAAsyncSelect on the socket and when there's WSAEWOULDBLOCK just leave the send-routine instead of looping and wait for the notification to be able to send again.

I would like to try test it when I have the chance. It looks impressive!
Posted on 2003-05-04 17:00:58 by david
Thanks for taking the time to reply David, there is somebody out there!

From reading loads of tutorials i know how i SHOULD be using send, but it just seems to cause such a massive headache that i went for the easy (lazy) option. I've looked at loads of source code for the same kind of app and everyone seems to use send in a similar way to me.

I dont know what kind of problems using send in this way will create, if any..Thomas will probably know ;) but i think its fine when sending small amounts of data about.

Cheers,
Lennon.
Posted on 2003-05-04 17:45:30 by Lennon
Hi Lennon,

I have just checked your source code and run executables :

Your app looks impressive at source code level , all that RichEdit Controls and fonts/colors set; memory alocations, server commands etc.

Overall it is a very good start, well done!


Now lets get to the wishlist part ....

I have noticed some problems with UI:
(my own feelings not huge issues)

-autostartup of server / auto logon of clients is not a thing I would like.

I like to take my time and connect to servers when i want to, in this regard i also like to be able and disconnect from server or stop server without program exit...

- There is a need for input of the IP of the server to connect to ... at runtime i mean

- You need to get a list of connected users from the server and deal with users in out.

-What is my user name ? Can I set/change it soemwhere please

-I would add (and indeed i will do so for HE server/client) a list of available channels.

It looks like we where working to the same kind of application in the same time :D...

Well for different reasons i suspect...but still funny :P
Posted on 2003-05-05 21:07:58 by BogdanOntanu
Hi Bogdan,

You say a lot of sensible things in your post, and would agree with all of them! appart from that my app isnt aimed at that kind of thing, i just made it for my little home network, and as a way of learning a bit about Winsock.

At the moment its doing most of the things i want it to.

----autostartup of server / auto logon of clients is not a thing I would like.

For my app this is perfect as i want the server to just be running when i turn my ICS pc on, i dont want to have to even know its there untill somebody wants to talk to me (thats why i have set things up so it can auto start in the sytem tray, server and client) same go's for all the other pc's in the house and their clients, i want everything to be invisible.

----There is a need for input of the IP of the server to connect to ... at runtime i mean

see above.

----You need to get a list of connected users from the server and deal with users in out.

My server does have a list of connected users internally, im not sure what you mean by "deal with users in out" i dont think my mother in law would like me kicking her out of chat!! *altho it could be fun*

----What is my user name ? Can I set/change it soemwhere please

yes you can change your username, just type it in and click on "name" or use ALT+n
yer username/font/font colour are all saved on exit and re-loaded on startup.

----I would add (and indeed i will do so for HE server/client) a list of available channels.

dont need them, that could be interesting to implement tho.

----It looks like we where working to the same kind of application in the same time :D

Indeed it does :grin: if you need ANY help dont hesitate in asking me, i'll try and help, altho im as new at this as you :stupid:

Best of luck Bogdan,
Lennon.
Posted on 2003-05-06 06:11:10 by Lennon
*Changes his name to "ThreadKiller" *
Posted on 2003-05-09 04:37:51 by Lennon
haha, im surprised this thread isnt at least a little bit more lively, as it presents an interesting subject i feel.

I like your code Lennon, and am just starting to learn ASM myself. Im heading for the sockets side of things so your code is definately a good example for me to start with.

Great work :D

- binary.
Posted on 2003-05-26 17:49:50 by binary
hello binary,

Thank's for the input, i posted the source on here because i wanted to try and help people just starting out in winsock like yourself, indeed im still new to it myself.. and when i first came to winsock i was looking all over for some simple winsock source code.

I find reading other peoples code a good way of learning, if it helps you even a tiny bit it was well worth the hastle.

Cheers,
Lennon.
Posted on 2003-05-27 19:30:47 by Lennon