Jump to content

tcp


Recommended Posts

  • Moderators

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

Link to comment
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 )

Link to comment
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 )
Edited by kip
Link to comment
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....

Link to comment
Share on other sites

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
Link to comment
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.

Link to comment
Share on other sites

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...