Jump to content
Sign in to follow this  
Glyph

Server client file sending

Recommended Posts

Glyph

Heres an example, this is the server script

Global Const $IP = @IPADDRESS1 ;Local IP address on NIC #1
Global Const $Port = 51200

Dim $Socket = -1 ;TCPAccept/Main socket
Dim $Listen = -1 ;TCPListen
Dim $Buffer = -1 ;TCPRecv 

TCPStartup()

$Listen = TCPListen ($IP, $Port)

While 1
    $Socket = TCPAccept ($Listen)
    If $Socket = -1 Then ContinueLoop
    DoStuff ($Socket)
WEnd

Func DoStuff ($Socket)
    $Buffer = TCPRecv ($Socket, $Port)
    If $Buffer Then
        Switch $Buffer
            Case "Hello"
                ;( this is where i want the file to be sent)=======================
        EndSwitch
    EndIf
EndFuncoÝ÷ Ø ÝrXجjëh×6
#include<guiconstants.au3>
Global Const $ServerIP = @IPADDRESS1 ;Local IP address on NIC #1
Global Const $Port = 51200

Dim $Buffer = -1 ;TCPRecieve
Dim $Socket = -1 ;TCPConnect/Main socket

TCPStartUp()

Opt("GUIOnEventMode", 1)
GUICreate ("Client", 260, 100)
$Button = GUICtrlCreateButton ("Button", 170, 70, 80, 20, $BS_DEFPUSHBUTTON)
GUICtrlSetOnEvent($button, "_Button")
GUISetState ()

While 1
    Sleep(10)
    If $socket = -1 then ContinueLoop
    $Buffer = TCPRecv ($socket, $Port)
    If Not $Buffer Then ContinueLoop
    Switch $Buffer
        Case "Hi!"
           ;( this is where i want the file to be recieved)=======================
    EndSwitch
WEnd

Func _Button ()
    $Socket = TCPConnect ($ServerIP, $Port)
    TCPSend ($Socket, "Hello")
EndFunc

;) Please help... i read the readme, still can't figure it out.


tolle indicium

Share this post


Link to post
Share on other sites
Richard Robertson

Readme? Try the help file instead. The help file has real documentation.

This looks like a "write a script or snippet for me" request.

Share this post


Link to post
Share on other sites
Glyph

Help file readme, same thing to me... anyway i seriously read the crap out of this i've been working on it all day, and i can't find the command to make it send the file. everything i try gets an error... sorry for sounding like a beggar i don't mean to be...

Edited by backstabbed

tolle indicium

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.