Jump to content

How to make script communicate through tcp in lan


Recommended Posts

Hi! every one....

I wanted to make script which can communicate through lan..but i don't know how to use TCP functions. I knw nothing about tcp.Is there anyone who can explain it to me....with an example or somethng else...PLZ...

Thx..

[font="Comic Sans MS"][size="7"]Piyush.....[/size][/font][font="Palatino Linotype"][size="2"]Some Of My Scripts...Cool Font Generator Train Searcher and Tracer[/size][/font]

Link to comment
Share on other sites

hey i followed your advice and learnt it a little bit ..but i am facing a problem..

the things i have learnt are

there is a server and a client..

we can create a server on our ip address and a specific port.. with TCPlisten function..

then run a while loop to accept and receive data..through TCPAccept and TCPReceive

the next script is a client script...where it connects to the server with TCPConnect and sends and receive data o server with TCPReceive and TCPSend.

the client can send and receive data and i know that server can receive data but how can server send data to a client whom it has received data...

i tried this...

server side

TCPStartup();~ create a roooooom
$room=TCPListen("192.168.20.224",6561)
if @error Then  MsgBox(0,'','Error')Else    MsgBox(0,'','done')
EndIf
While 1
$dooropen=TCPAccept($room)
$recivedata=TCPRecv($dooropen,100000000)
if $recivedata ThenMsgBox(0,'',$recivedata)
TCPSend($dooropen,"Thanks")
EndIf
WEnd
TCPShutdown()

and client side

TCPStartup()
$room=TCPConnect("192.168.20.224",6561)
if @error ThenMsgBox(0,'','Not Connected')
Exit
EndIf
$send=TCPSend($room,"pagal pan")
While 1
    $data=TCPRecv($room,100000)
    if $data Then       
MsgBox(0,'messagereceived in client',$data)  
  EndIf
WEnd
TCPShutdown()

but this is not working.... PLZ HElp me out..

Edited by Piyush

[font="Comic Sans MS"][size="7"]Piyush.....[/size][/font][font="Palatino Linotype"][size="2"]Some Of My Scripts...Cool Font Generator Train Searcher and Tracer[/size][/font]

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