Sign in to follow this  
Followers 0
yucatan

tcp

14 posts in this topic

#1 ·  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

Share this post


Link to post
Share on other sites



:) 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.

Share this post


Link to post
Share on other sites

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 )

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

#6 ·  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

Share this post


Link to post
Share on other sites

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....

Share this post


Link to post
Share on other sites

#8 ·  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

Share this post


Link to post
Share on other sites

doesn't matter so much, just a port below 1024

hmm.. do i need to open the port then ???? in my router (i hope not)

Share this post


Link to post
Share on other sites

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)

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

#14 ·  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

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0