Click to See Complete Forum and Search --> : Winsock: Multiple forms with one one winsock?
Chillax
Jun 25th, 2006, 05:30 AM
Greetings everyone,
I'm just wondering, is it possible to have more than one form with controls using only one winsock placed at a main form? I tried actually doing this, but it didn't work properly.
I've downloaded Pino's chatroom guide, and added a button which opens a new form. It contains a button and a textbox. I wanted that when you press the button, whatever is written in the textbox is sent to the server, through winsock at the main form, and recieve it back and display it in a message box for example. When I tried to do this, the message box kept displaying the "previous" data sent instead of current which is in the textbox.
Can anyone please advise me on this matter? I'd really appreciate it!
g4hsean
Jun 25th, 2006, 05:55 AM
ok when you are sending messages be sure to clear memory of the last sent message.
example:
you send : "hello"
then you send : "good"
you want it to look like this
ME : hello
Me : good
but instead you get this
ME: hello
ME: hellogood
is that what it looks like. If not post code and ill fix it in a snap. :wave:
Chillax
Jun 25th, 2006, 07:09 AM
The case is as follows:
I send: "Something"
I get: nothing
Then I send: "other thing"
I get: "Something"
And if I press the button again I get "Other thing". There is some delay that I don't seem to understand.
My idea is that I want to send data and recieve it as it is, after some period of time, and store it in a variable. I want to know when recieving occurs so I can continue processing data.
g4hsean
Jun 25th, 2006, 03:59 PM
ok im looking into it as we speak
g4hsean
Jun 25th, 2006, 05:43 PM
Very nicely coded, well indented and you use all functions in vb I give you an A++ on this program. However there were flaws in some of the code, I recommend looking over and fixing them. I fixed the part with the user list and fixed your problem as well, I also added a couple of things such as connection items and a little more.
I see that both the server and client are identical in many ways and thought maybe your developing some sort of main client program in witch all connecters connect to that one program. But I think you did very well and here's the code. If you like the help then please rate me since I’ve never had anyone rate me for my help. And good luck on that amazing program.
I also want to add that I fixed the program using 1 computer so please check connecting section and modify if you need to.
g4hsean
Jun 25th, 2006, 05:55 PM
I also forgot to respond to first question on multiple connections on one port and I’ve looked around and found that it is impossible to connect multiple connections on one port. But there is a way to do this. If you were to get all connecters to connect to one port on client machine, then get client to give server machine a port that is not in use to connect to, then client would disconnect from client and reconnect using port that is not used.
Example:
Server connects to the client’s machine on the port that redirects you to an open port
Then client looks for an open port not in use takes the port number and sends it to you "server"
Then server connects to the port that client sent and voila, you'll be able to connect
multiple computers to your chat program.
Ask me any questions if needed on this subject, ill try to answer clearly.
g4hsean
Jun 26th, 2006, 10:20 AM
Ok I’m just about finished an ultra chat room for you it comes with the client program that you made but redid a bit of the code to work with ultra backbone server.
SPECS:
1- Able to hold 15 people
2- Port redirection (also good if you want multiple computers to connect to open ports)
3- User list fixed
4- Message problems fixed
5- Automatic port close if user has shut it down via task manager
6- Shows when someone logs in
And much more.
All I need to finish up is the message synchronization and user list synchronization so like that new messages since login are added to client received messages. Also user synchronization so like that you have up to date list of users connected. And also the ability to have multiple users under same user name. Your probably asking why do I care about multiple users with same username, well I added a new feature that always takes out the right user no matter what.
Chillax
Jun 26th, 2006, 12:37 PM
Oh my god!
Thanks alot mate!
g4hsean
Jun 26th, 2006, 02:46 PM
no problem man im always willing to help. Ive got one thing left on chatroom program and then im posting it here it's amazing you'll love this one guaranteed.
P.S Please rate me on what you thought of my help since i've never been rated for my help.
g4hsean
Jun 26th, 2006, 02:47 PM
oh sorry you did rate me lol. Thats what i mean never been rated before :p
Chillax
Jun 26th, 2006, 02:48 PM
If I could, I would rate you 10,000 times mate!
Thanks again!
g4hsean
Jun 27th, 2006, 02:17 PM
lol thanks chillax! And by the way i also made this for you to. This is the chat room program i made to show you how to connect multiple computers to you.
Im sorry about messy coding and also about the 100's of lines of code but i was a in a bit of a rush so please excuse me on that. If you have any problems or questions contact me im always on. :p :p :cool: :D
P.S check specs in previous responses
the182guy
Jun 27th, 2006, 02:38 PM
see www.winsockvb.com for good winsock tutorials, there is a tutorial for a chat room, step by step
g4hsean
Jun 28th, 2006, 06:48 AM
I beleive that there may be a problem when loading client program project if it says can't find a file then please contact me ill post one with all files.Like i said i think there is a problem so please check itout to see if there is.
g4hsean
Jul 1st, 2006, 03:45 AM
i found glitches in the code i posted i've fixed most of them just wait until i test over internet to see if it works perfectly then ill post the projects.
Chillax
Jul 1st, 2006, 09:05 AM
Hey mate! Sorry I've been outta town so I couldn't get a chance to check on your progress. Thanks alot for your valuable effort and I'll be waiting patiently until you completely debug the project so I can start learning from it. :D
g4hsean
Jul 1st, 2006, 09:20 AM
just your lucky day everything is dubugged and found no glitches so heres the project.
If problems occur please contact me. Im not sure if form will load properly but i believe i fixed that problems so cheers. :p
Chillax
Jul 1st, 2006, 09:23 AM
Wehoo! I'll go through it when the world cup match ends. :D
g4hsean
Jul 1st, 2006, 09:24 AM
i forgot to also say Welcome to the forums Chillax!
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.