egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

php - tcl data sending

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
putyn
Voice


Joined: 07 Feb 2011
Posts: 2

PostPosted: Tue Feb 08, 2011 12:27 pm    Post subject: php - tcl data sending Reply with quote

ok as i was advised i opened a new topic and ill explain here what i want to do

i want to open a connection from a php script to my eggdrop bot and to send some data (text) to the bot and the bot after reads the data will have to send some data (text) back
now i know how send text to the bot from php what i can't figure out how to send data from the bot using the connection made by the php script

any ideas are appreciated
Back to top
View user's profile Send private message
Ofloo
Owner


Joined: 13 May 2003
Posts: 953
Location: Belguim

PostPosted: Tue Feb 15, 2011 9:58 am    Post subject: Reply with quote

use server socket

untested sample code i think it requires tclsh8.5 because of the clock micro

Code:
proc server_app {s cli_addr cli_port}  {
  while {![eof $s]} {
    flush $s
    gets $s buf
    append new_buf $buf\n
  }
  if {[info exists new_buf]} {
    if {![string equal {} $new_buf]} {
      set micro [clock micro]
      if {![catch {open /tmp/blah.${micro} w} wf]} {
        puts $wf $new_buf
        putlog "wrote data to /tmp/blah.${micro} received from $cli_addr on port $cli_port"
        close $wf
      }
    }
  }
  close $s
}

socket -server server_app 65000

_________________
XplaiN but think of me as stupid
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber