XBenny Posted November 5, 2011 Posted November 5, 2011 (edited) hi guys all gem? tou need of some help: I need to connect to a server over TCP, the tcpsend send data and receive the tcprecv, but need to do it all together, all functions at once, and tcpsend tcprecv, how I do it? thank you Edited November 5, 2011 by XBenny
martin Posted November 5, 2011 Posted November 5, 2011 After 14 post I would have expected you could do a lot better than that. I'm looking forward to the 16th Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
water Posted November 5, 2011 Posted November 5, 2011 Did you have a look in the help file for TCP...? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
XBenny Posted November 6, 2011 Author Posted November 6, 2011 Yes, I looked. I need to send a packet of data to a server, the packet has to send 116 bytes of data, but he is sending twice as many do not know why, I am sending it as a string, I'm doing something wrong, he has to send the form otra ?
martin Posted November 7, 2011 Posted November 7, 2011 If you need to send 16 bytes then probably you should be sending binary data, but to get better help you need to show some code. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
trancexx Posted November 7, 2011 Posted November 7, 2011 Don' forget to prepend your string with "0x" for binary. ♡♡♡ . eMyvnE
clicked Posted November 7, 2011 Posted November 7, 2011 Yes, I looked.I need to send a packet of data to a server, the packet has to send 116 bytes of data, but he is sending twice as many do not know why, I am sending it as a string, I'm doing something wrong, he has to send the form otra ?If twice as many bytes as expected are being sent, I would check to see if the sender is sending unicode instead of ascii.
water Posted November 7, 2011 Posted November 7, 2011 What does your code look like? How does the received data look like? TCPRecv has a flag to return binary data. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
XBenny Posted November 7, 2011 Author Posted November 7, 2011 (edited) aqui está o codigo: "code" onde o primeiro packet enviado é para dizer para o servidor que eu estou conectando, e o segundo é o packet de login, para liberar o meu acesso. o certo seria ele enviar 116 bytes, mas está enviando o dobro que é 232, e no primeiro enviar 4 bytes, mas está enviando 8, onde devo mecher onde está errado? tem que enviar como string mesmo como que eu faço? obrigado ja pela ajuda de vocês. ------------------------------------------------------------------------ google tradutor: here's the code: func tcp() tcpstartup() $connect = tcpconnect('189.112.1.166', 8281) write("open socket id: " & $connect) _send('11F3111F') _send('7400F68807E684FD123CBA132B236B2D3127E4F906FFECFD78666032FB243000D2F130FBF4F194FC72E964FB00F0F0FD22F05CFDBAF16CFD06EDCCFD1EF1F4FDFAFDD4FAFAE8E8FBFAECF0FD0CFC40FA4AF18CFD30F1F4FDFAF1F4FB000EE4FDE7F1F4FD399E53B9C63138232D8BE191F5FB98B2') $recv = tcprecv($connect, 999999) write("recv: " & $recv) EndFunc func _send($packet) $send = tcpsend($connect, $packet) write("offsets enviados: " & "(" & $send & ")" & " - " & $packet) endfunc func write($write) consolewrite("[" & _NowTime() & "] - '" & $write & "'" & @CR) endfunc where the first packet is sent to tell the server I'm connecting, and the second is the login packet, to release my access. right he would send 116 bytes, but is sending twice that is 232, and the first 4 bytes to send, but sending is 8, which is where I shake wrong? have to send it as string as I do? Thank you in advance for your help. ----edit Don' forget to prepend your string with "0x" for binary. had not read your post sorry, I think it worked thanks! Now the code looks like this: func tcp() tcpstartup() $connect = tcpconnect('189.112.1.166', 8281) write("open socket id: " & $connect) _send('11F3111F') _send('7400F68807E684FD123CBA132B236B2D3127E4F906FFECFD78666032FB243000D2F130FBF4F194FC72E964FB00F0F0FD22F05CFDBAF16CFD06EDCCFD1EF1F4FDFAFDD4FAFAE8E8FBFAECF0FD0CFC40FA4AF18CFD30F1F4FDFAF1F4FB000EE4FDE7F1F4FD399E53B9C63138232D8BE191F5FB98B2') $recv = tcprecv($connect, 999999) write("recv: " & $recv) EndFunc func _send($packet) $send = tcpsend($connect, "0x" & $packet) write("offsets enviados: " & "(" & $send & ")" & " - " & $packet) endfunc func write($write) consolewrite("[" & _NowTime() & "] - '" & $write & "'" & @CR) endfunc ----edit mas agora estou com outro problema, eu consigo me conectar perfeitamente com o servidor, mas o servidor precisa de me enviar um packet de resposta com aproximadamente 1900 bytes, porem ele não esta enviando, ele envia este packet logo depois que eu mando o packet de login, onde eu estou errado? tenho que fazer algum thread para os dois serem ativados simultaniamente? alguem pode ajudar? obrigado! ------------------------------------------------------------------------ google tradutor: but now I have another problem, I can connect perfectly with my server but the server needs to send me a response packet with approximately 1900 bytes, but he did not send, it sends this packet after I send the packet to login, where I'm wrong? I have to do some thread to the two simultaneously be activated? can someone help? Thank you! Edited November 7, 2011 by XBenny
martin Posted November 8, 2011 Posted November 8, 2011 Maybe you should use the flagg set to 1 in TcpRecv. Possibly you should wait for a connection before you send the string. (See TcpAccept.) Maybe you need to increase the timeout on tcp functions.(Opt(TcpTimeout,???)) Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now