Jump to content

Recommended Posts

Posted (edited)

hi is it possebel to send a $var from the server to the client? i'm trying for 3 days now and i cànt get it working pleas somebody help me.

PLEAS

Edited by yucatan
  • Moderators
Posted

:) hi is it possebel to send a $var from the server to the client? i'm trying for 3 days now and i cànt get it working pleas somebody help me.

PLEAS

Are we to guess what $var is?

The answer is a "simple" yes. Now, whether what you've coded can, well that remains a mystery as you haven't posted the code you've tried, what succeeds, and what fails.

A guess: Use StringToBinary before sending, and BinaryToString to decipher.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Posted

ok i post code server

;SERVER!! Start Me First !!!!!!!!!!!!!!!

$g_IP = "127.0.0.1"

; Start The TCP Services

;==============================================

TCPStartUp()

Dim $stream = "streaming"

; Create a Listening "SOCKET"

;==============================================

$MainSocket = TCPListen($g_IP, 65432, 100 )

If $MainSocket = -1 Then Exit

; look for client connection

;--------------------

While 1

$ConnectedSocket = TCPAccept( $MainSocket)

If $ConnectedSocket >= 0 Then

TCPSend($ConnectedSocket, $stream)

EndIf

Wend

client

;CLIENT!!!!!!!! Start SERVER First... dummy!!

$g_IP = "127.0.0.1"

; Start The TCP Services

;==============================================

TCPStartUp()

$stream = ""

; Connect to a Listening "SOCKET"

;==============================================

$socket = TCPConnect( $g_IP, 65432 )

If $socket = -1 Then Exit

TCPRecv( $socket, 2048 )

MsgBox(4096, "Test", $stream )

Posted

are you in a local network? maybe you can try @IPAddress1 than.

i'm writing it on one system but i can connect that for sure but giving the var from the server to the client that dont work

Posted (edited)

what if you use this client script?

;CLIENT!!!!!!!! Start SERVER First... dummy!!
$g_IP = "127.0.0.1"
; Start The TCP Services
;==============================================
TCPStartUp()
$stream = ""
; Connect to a Listening "SOCKET"
;==============================================
$socket = TCPConnect( $g_IP, 65432 )
If $socket = -1 Then Exit
do
$Recv = TCPRecv( $socket, 2048 )
until $Recv
MsgBox(4096, "Test", $Recv )
Edited by kip
Posted

what if you use this client script?

;CLIENT!!!!!!!! Start SERVER First... dummy!!
$g_IP = "127.0.0.1"
; Start The TCP Services
;==============================================
TCPStartUp()
$stream = ""
; Connect to a Listening "SOCKET"
;==============================================
$socket = TCPConnect( $g_IP, 65432 )
If $socket = -1 Then Exit
do
$Recv = TCPRecv( $socket, 2048 )
until $Recv
MsgBox(4096, "Test", $Recv )

thats right.. so .. whats your piont

;--------------------

While 1

$ConnectedSocket = TCPAccept( $MainSocket)

If $ConnectedSocket >= 0 Then

msgbox(0,"","my server - Client Connected")

TCPSend($ConnectedSocket, $stream)

EndIf

Wend

so that means do it when it returns NO error then do

msgbox(0,"","my server - Client Connected")

TCPSend($ConnectedSocket, $stream)

i know that -1 is the error level so 0 means NO error....

Posted (edited)

thats right.. so .. whats your piont

;--------------------

While 1

$ConnectedSocket = TCPAccept( $MainSocket)

If $ConnectedSocket >= 0 Then

msgbox(0,"","my server - Client Connected")

TCPSend($ConnectedSocket, $stream)

EndIf

Wend

so that means do it when it returns NO error then do

msgbox(0,"","my server - Client Connected")

TCPSend($ConnectedSocket, $stream)

i know that -1 is the error level so 0 means NO error....

hehe it works can u tell me what i did wrong?

i need that this prog always work,, witch port i can use the best ?

Edited by yucatan
Posted

The computer with the server should have a port opened.

All the clients don't have to open a port, they only need to have acces to the internet. (the firewall should also be configured)

damm then my prog wont work.

Posted (edited)

what are you trying?

a streamer and a checker and when i enter your IP adres in the checker then the checker needs to detect if you have the streamer installed so i work with a directi connection now maby i need to do it els then maby i need to make it like this then the streamer makes a file on a server somehere and that the checker search in server to your ip or something thats with a server now is the prog U run the server,

Edited by yucatan

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...