
Valiant8086
Members-
Posts
10 -
Joined
-
Last visited
Everything posted by Valiant8086
-
Anybody got an example client I can look at that is able to change connection details and reconnect while the application is running? That's what I was talking about in my last pot. I cant figure out how to connect with new details after the client is already running. The example mini client I got with this just connects on startup and if it fails to connect closes.
-
Thanks. I've gotten hold of the Verso autoit object files needed and have constructed a server. Now I am working on the client, and I'm stumped. All I can think of to do is to give the basic idea and see if anyone can jog my brain. From my point of view it kind of looks like I can't use this client but I'm sure I can once I know how to start. Basically the client will load the port and IP from an .ini when it is started. It should try to connect using that immediately on load. If the connection fails or the user supplies a different IP or port that makes the current connection invalid it needs to try to connect using the new settings. It should always try to reconnect if the connection is lost or if the attempt to connect fails. The outcome is that the client should always be connected when it is running unless the server isn't available or there is a connection problem or the IP or port is typed wrong etc. The version I had before I tried this new one here would disconnect the client when the user started to edit the IP address field which was always on screen even while connected and would try to reconnect again when it decided the user had typed a complete IPv4 address. This worked pretty nicely but there could be issues like the user may have been going to put two more digits on the IP address when the loop came around and decided the data in the input field was an IPv4 address, which it may have been. Think 184.84.84.1 , could have been .184 on the end. That and the user could not try a host name. I will be dropping this idea but I do want the client to do a great job at maintaining it's connection indefinitely and if the connection fails I want it to paciently lounge around and make periodic attempts to reestablish the connection indefinitely. Can I have some help with how to do this with the object? I'm stumped on how and where to construct the class, and how to modify it and handle things properly when the configuration is changed. I also plan to support use of different passwords, but I hope that if I can get some help with what I've asked about I'll be able to figure the rest out. I can run a function in my main loop that would make it connect, but the class is constructed with the port and IP specified. How to try next time using the new configuration? The mini client just tries to connect once and if that fails it closes. That's definitely not what I need to do. My client will sit with certain controls grayed out while it makes attempts to connect. I'll shut up now because I'm afraid if I try to say anything else I'll start to confuse myself. I could add in snipets from my main code but I haven't really done anything with it yet because I haven't an idea how to even start so there is nothing to show. Thank you all very much, especially the one who wrote this class.
-
Yo. I'm trying to convert to this UDF. Right now I seem to be missing the include files. The orriginal post in this thread says they're in the zip. I got a .rar rather than a zip for one thing, and the only thing in that .rar are server.AU3 and client.AU3.and a docs folder. Any tips? Thanks
-
encrypting a tcp client and server
Valiant8086 replied to Valiant8086's topic in AutoIt General Help and Support
Hi. I just downloaded the TCP with OOP thing. I'll take a look at it, but man, if I switch to this one, it'll be like the 5th time I've switched to a different tcp server/client UDF. Darn, the one I have ought to work. -
Hi. First, on my phone I get a much nicer version of the autoit forums. Can I get that same alternative on the computer? I'm having trouble with the main autoit forum. Too much content. The pages are too big and when I have a page open to the forum it lags my entire computer down. Ok, that said, I do have an autoit related question after all. Basically, I'm trying to send an encrypted string from my client to my server. The client encrypts the command, sends it to the server, the server decrypts it, and follows the command if valid. But it's not that simple it seems. I've got the client and server doing msgboxes for the time being so I can debug. The client shows the encrypted string that it's going to send, usually starts with 0x something. After I click ok it sends it. Now the server does a message box that shows the same string. I press ok and up comes another message box that's supposed to show the string that the client started with before the client encrypted it, but it's completely different. I've made sure I use the same password. I've checked to make sure I'm not encrypting @CRLFs. I've tried aes256bit and Rc4 with more or less the same result. In those message boxes I put something like msgbox(0, "", "heh"&$data&"heh") . This has allowed me to ensure during my debugging there are no whitespaces before or after the string on both ends of the communication, and also the hehs are on the same line as the $data, so that would indicate the lack of @CRLFs, which is desirable. I've made sure that when I go decrypt that an @CRLF hasn't been added in using the same method I just mentioned. Those msgboxes with the hehs around the string look exactly alike. All the encrypted characters are the same on both ends. So I think the problem is just on the server side. It is not decrypting properly. I have explicitly instructed it to create a new key with the password of "zomg" on both the client and server, don't worry this isn't the password I will always use for this, and I have supplied that key the same way to both the client and the server. Any suggestions Would it have something to do with it being a different data type when it arrives to the server? I've tried different things with stringToBinary and binaryToString but while I do get different results none are anywhere near to being correct. Thanks. I would include a copy of the script but I have bits and pieces of information that I wouldn't want public such as the real password I use. I hope in view of that I have done a good job explaining the situation. If not I can create a copy of the client and server that have been stripped to post here for examination. Keep in mind that I do believe I have tracked the bug down to being somewhere in the server side, as the server seems to see the same encrypted string the client sent before the server goes to work to decrypt the string.
-
Thanks, looks like all I needed was @crlf at the end of the sent message. Huge help. Thanks much.
-
One of the client attempts is below. This is the one based off the autoit help file example. This should work because my server will throw up message boxes along with the one this client throws up, if it connects that is. For me, this client here gives the same error if the server is not running as it does if it is, 10023 I think it is. I don't think it's something quite as simple as I typed the IP or port wrong, that's the same IP and port I use with telnet, unless it's something like I need to not have quotes around them or something, lol. If I could, I'd fire up a server and see if anyone else could get anything out of it, but my connections are natted even before you get to my routers, both of them are. The intent I have is to run the server on a friend's computer to have it perform, with the friend's permission, more internet heavy tasks. Converting of large files into smaller ones, things like that, because my internet sucks and has low data caps. Thanks for any assistance. TCPStartup() $ConnectedSocket = TCPConnect("127.0.0.1", "25999") If @error Then MsgBox(4112, "Error", "TCPConnect failed with WSA error: " & @error) Else While 1 $szData = InputBox("Data for Server", @LF & @LF & "Enter data to transmit to the SERVER:") If @error Or $szData = "" Then ExitLoop TCPSend($ConnectedSocket, StringToBinary($szData, 4)) If @error Then ExitLoop WEnd EndIf This, by the way, is just an attempt to get it working. I thought I'd start with the down to level raw auto it code again. P.S. Does anybody know off hand if it's possible to get the mobile version of this forum to run in a full pc web browser? This site seems to be awfully large and sluggish. And the tool bar thing with all those edit controls keeps coming up even though I collapse it. Here's another edit: I knew I must have done something wrong with the example I posted above. I forgot to put TCPStartup() at the top. I'm putting it in there now. NSice I did that, I can now connect, but like with the other clients, can't get messages to register on the server. The client now shows the input box and sends up a new one when I type something and hit ok, but the server does nothing. wher with telnet if I where to type hi the server would throw up a message box saying "hi".
-
I can't figure out how to edit my previous post. I created another client using example code from the autoit help file and it doesn't even connect to my server that uses this code. Weird. Telnet still connects and properly sends messages and receives them with this server, but none of my clients, in several different codebases, work well with it. All of them do connect though except the one that's based off the autoit example code. If somebody had a client that they know works with this server and could share it, I could try that and see if it works. I'm sure stuck. Thanks again. PS. Why does this post have an edit link and the one above doesn't?
-
Hi. I've also started trying to use this. I first tried making one of my own, but the server kept on becoming non functional after having ran for a few minutes with no activity. The client would think it connected to the server, but the server would not mention that the client had connected and wouldn't respond to any of the client's requests like it was supposed to, but if I kept using the server from the client, it would work fine. I wonder if it had something to do with dead connections not dropping or what ever, something this server you have here looks to have solved. So that was when I started looking around to see if I could find some code where hopefully someone else had done that work for me, and the first thing I found was the event driven UDF that's also on this forum. I think if it had worked, I would have really liked that option. I ported my server and client to use it's implementation, and the server and client correctly identified when one another disconnected and connected, but neither ever managed to send messages back and forth at any time. So I gave up on that one and found this one. I posted a comment on that event driven UDF's topic asking for help, bt no replies yet so I am trying this one. Well I have my server based on this code working fine. I have not really changed the client much. I can't send messages to this server either. I can telnet messages to the server all day long but cannot get my own client to work. Does anyone have an example client that should work with this server implementation?
-
Hi. I think this is exactly what I have been looking for. I'm stuck just now though, can't seem to get my server to notice a message from the client. Here's the client code: #include <GUIConstantsEx.au3> #include <TCP.AU3> Func Connected($connection, $iError) If not $iError Then TrayTip("Client", "Connected...", 5) Else TrayTip("Client", "Failed to connect!", 5, 3) EndIf EndFunc func disconnected($connection, $iError) TrayTip("Client", "Connection closed or dropped", 5, 2) endFunc func receive($session, $iError) TrayTip("Client", "received", 5); not sure if this works, the server is where the problem is that I know of endFunc func disconnect() _TCP_Client_Stop($connection) endFunc func process(); my gui has a button to click that calls this msgbox (0, "", "processing "&guiCtrlRead($input));This works, but the msgbox on the server doesn't pop up after I ok this TCPSend($connection, guiCtrlRead($input)); input is an edit field in the client to type something to try sending to the server endFunc Func terminate() _TCP_Client_Stop($connection) Exit endFunc while 1 if not $connected and isIPV4Address($serverIP) then;$connected is a variable that's assigned properly in code that's stripped from this snippet, same as isIPV4Address $connection = _TCP_Client_Create($ServerIP, 25999) _TCP_RegisterEvent($connection, $TCP_RECEIVE, "Received") _TCP_RegisterEvent($connection, $TCP_CONNECT, "Connected") _TCP_RegisterEvent($connection, $TCP_DISCONNECT, "Disconnected") endIf sleep(500) wend That's the end of the client code, here's the server. global $connection = _TCP_Server_Create(25999) _TCP_RegisterEvent($connection, $TCP_NEWCLIENT, "NewClient") _TCP_RegisterEvent($connection, $TCP_DISCONNECT, "Disconnect") _TCP_RegisterEvent($connection, $TCP_RECEIVE, "Receive") Func NewClient($session, $iError) _TCP_Send($session, "connected"); Haven't set up the receive function on the client so don't know if it works that way. EndFunc Func Disconnect($session, $iError) ;I have a notification coded in here EndFunc func getIP($IP) return _TCP_Server_ClientIP($IP);works great till I try to use it to get the IP of a disconnected client. Any suggestions on that while we're at it? endFunc func receive($receivedData, $iError) msgbox(0, "server", "received "&$receivedData); doesn't seem to be working though the process function in the client does pop up it's own msgbox endFunc func terminate() _TCP_Server_Broadcast("shutdown") _TCP_Server_Stop() sleep(1000) exit endFunc while 1 sleep(100) wend