AutoHotkey Community

It is currently May 26th, 2012, 2:19 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 128 posts ]  Go to page Previous  1 ... 4, 5, 6, 7, 8, 9  Next

Would you use this script?
Yes
No
Frequently
Maybe once or Twice
You may select 1 option

View results
Author Message
 Post subject:
PostPosted: January 6th, 2009, 6:44 pm 
Offline

Joined: August 14th, 2007, 12:11 pm
Posts: 86
ADDED PM FEATURE
USAGE: /w USERNAME ( send a pm request to the other user and opens a window on his end if the pm gui does't exist)
To be improved :
-ENTER send the message in the pm window too
-Open a window for each pm (in the pm window the last user that sent a pm is the on the new pm is sent to ex: you receive a pm from Anonimus it opens the window if doesn't exist and shows the message. if no one else pm's you the pm from the pm window goes to Anonimus. In other words the last user that spoke in your pm window receives your pm besides you)

SERVER
Code:
#singleinstance force
#Persistent
;#notrayicon

logedin=0
logo=
(
~~~~~Welcome to Winsock-Chat!~~~~~
To register use
/reg username@password
)
ifnotexist,Settings
{
Filecreatedir,Settings
}
ifnotexist,Settings\logo.txt
{

logo:=Enc_Hex(logo)
fileappend,%logo%,Settings\logo.txt
}
else
fileread,logo,Settings\logo.txt
ifnotexist,Settings\users.ini
iniwrite, password,Settings\users.ini, Users,Anonimus
Network_Address = 0.0.0.0
Network_Port = 1000

menu, tray, tip, Listening on`nIP: %A_Ipaddress1%`nPort: %Network_Port%
menu, tray, icon, %a_windir%\explorer.exe
menu, tray, nostandard
menu, tray, add, Restart
menu, tray, add, EditLogo
menu, tray, add, Show
menu, tray, add, Exit

colordef=C0C0C0
gui, color, %colordef%
Gui, Add, Edit, x6 y5 w360 h190 readonly vchat,
Gui, Add, Edit, x376 y5 w110 h150 readonly vchatlist,
Gui, Add, Edit, x6 y204 w210 h20 vSendText,
Gui, Add, Button, x226 y204 w70 h20 vSendviaNet gSendviaNet, Send
Gui, Add, Button, x6 y204 w296 h20 vstartsvr gstartsvr, Start Server
Gui, Add, edit, x306 y204 w70 h20 vkicknick,
Gui, Add, Button, x386 y204 w40 h20 vkick gkick_player, Kick
Gui, Add, Button, x446 y204 w40 h20 vKILL gkill, KILL
Gui, Add, Button, x376 y165 w110 h30 , Hide
;guicontrol,disable, kicknick
;guicontrol,disable, kick
Gui, Show, x135 y95 h233 w501, WinSock Chat Server
WinGet Gui_ID, ID, WinSock Chat Server
;Menu, OptionsMenu, Add, &Restart, Restart
;Menu, OptionsMenu, Add, &Edit Logo,EditLogo
;Menu, OptionsMenu, Add, &Hide,buttonhide
;Menu, FileMenu, Add, E&xit, Exit
;Menu, MyMenuBar, Add, &File, :FileMenu 
;Menu, MyMenuBar, Add, &Options, :OptionsMenu
;Gui, Menu, MyMenuBar
;guicontrol,disable, kicknick
;guicontrol,disable, kick
guicontrol, hide, startsvr
Gui, Show, x135 y95 h233 w501, Server
WinGet Gui_ID, ID, Server

Gosub Connection_Init

return

buttonhide:
winhide, Server
return

Show:
winshow, Server
   controlsend edit1, ^{end}, Server
return

$Enter::
ifwinactive, Server
{
gosub, SendviaNet
}
else
send, {ENTER}
return

Connection_Init:
OnExit, ExitSub 


socket := PrepareForIncomingConnection(Network_Address, Network_Port)
if socket = -1 
    ExitApp

Process, Exist
DetectHiddenWindows On
ScriptMainWindowId := WinExist("ahk_class AutoHotkey ahk_pid " . ErrorLevel)
DetectHiddenWindows Off


NotificationMsg = 0x5555 

OnMessage(NotificationMsg, "ReceiveData")


FD_READ = 1     
FD_CLOSE = 32   
FD_CONNECT = 20


if DllCall("Ws2_32\WSAAsyncSelect", "UInt", socket, "UInt", ScriptMainWindowId, "UInt", NotificationMsg, "Int", FD_READ|FD_CONNECT)
{
    MsgBox % "WSAAsyncSelect() indicated Winsock error " . DllCall("Ws2_32\WSAGetLastError")
    ExitApp
}



i=1
Loop
{
    VarSetCapacity(SocketAddress, SizeOfSocketAddress:=16)
    conectioncheck%i% := DllCall("Ws2_32\accept", "UInt", socket, "UInt", &SocketAddress, "Int*", SizeOfSocketAddress)
    if conectioncheck%i% != -1
    {
        i++
        peername := DllCall("Ws2_32\inet_ntoa", "uint", NumGet(SocketAddress,4), "str")
            . ":" NumGet(SocketAddress,2,"ushort")
           fileappend, %peername% connecting...`n,Settings\server.txt
   fileread, chat2,Settings\server.txt
   guicontrol,,chat, %chat2%
   controlsend edit1, ^{end}, Server
   Sendtext= RX2CLIENTCON:
   gosub, Send1
   ;sleep 100
   ;Sendtext=LOGO:%logo%
   ;gosub, send1
   ;Sendtext=
    }
    sleep 500
}   
return

SendviaNet:
Gui, Submit, NoHide
SendText =$ChatServer: %SendText%
guicontrol,,SendText,
go:
fileappend, %SendText%`n,Settings\server.txt
   fileread, chat2,Settings\server.txt
   guicontrol,,chat, %chat2%
   controlsend edit1, ^{end}, Server
gosub, send1
resend:
SendText= %ShowRecieved%
ShowRecieved=
send1:
Loop %i% {
   SendData(conectioncheck%A_Index%,SendText)
}
SendText =
return



PrepareForIncomingConnection(IPAddress, Port)
{
    VarSetCapacity(wsaData, 32) 
    result := DllCall("Ws2_32\WSAStartup", "UShort", 0x0002, "UInt", &wsaData) ; Request Winsock 2.0 (0x0002)
   
    if ErrorLevel
    {
        MsgBox WSAStartup() could not be called due to error %ErrorLevel%. Winsock 2.0 or higher is required.
        return -1
    }
    if result
    {
        MsgBox % "WSAStartup() indicated Winsock error " . DllCall("Ws2_32\WSAGetLastError")
        return -1
    }

    AF_INET = 2
    SOCK_STREAM = 1
    IPPROTO_TCP = 6
    socket := DllCall("Ws2_32\socket", "Int", AF_INET, "Int", SOCK_STREAM, "Int", IPPROTO_TCP)
    if socket = -1
    {
        MsgBox % "socket() indicated Winsock error " . DllCall("Ws2_32\WSAGetLastError")
        return -1
    }


    SizeOfSocketAddress = 16
    VarSetCapacity(SocketAddress, SizeOfSocketAddress)
    InsertInteger(2, SocketAddress, 0, AF_INET)   ; sin_family
    InsertInteger(DllCall("Ws2_32\htons", "UShort", Port), SocketAddress, 2, 2)   ; sin_port
    InsertInteger(DllCall("Ws2_32\inet_addr", "Str", IPAddress), SocketAddress, 4, 4)   ; sin_addr.s_addr

    if DllCall("Ws2_32\bind", "UInt", socket, "UInt", &SocketAddress, "Int", SizeOfSocketAddress)
    {
        MsgBox % "bind() indicated Winsock error " . DllCall("Ws2_32\WSAGetLastError") . "?"
        return -1
    }
    if DllCall("Ws2_32\listen", "UInt", socket, "UInt", "SOMAXCONN")
    {
        MsgBox % "LISTEN() indicated Winsock error " . DllCall("Ws2_32\WSAGetLastError") . "?"
        return -1
    }
   
    return socket 
}


ReceiveData(wParam, lParam)

{
Critical
   global ShowRecieved
    socket := wParam
    ReceivedDataSize = 4096
    Loop 
    {
        VarSetCapacity(ReceivedData, ReceivedDataSize, 0)
        ReceivedDataLength := DllCall("Ws2_32\recv", "UInt", socket, "Str", ReceivedData, "Int", ReceivedDataSize, "Int", 0)
        if ReceivedDataLength = -1
        {
            WinsockError := DllCall("Ws2_32\WSAGetLastError")
            if WinsockError = 10035
                return 1
            if WinsockError <> 10054
               
MsgBox % "recv() indicated Winsock error " . WinsockError           
ExitApp 
        }
     

        Loop, parse, ReceivedData, `n, `r
        {
           ShowRecieved = %ShowRecieved%%A_LoopField%
   ifnotinstring, Showrecieved, :
{
gosub, redirects
}

ifnotinstring , Showrecieved, LOGO
   fileappend, %ShowRecieved%`n,Settings\server.txt
   fileread, chat2,Settings\server.txt
   guicontrol,,chat, %chat2%
   controlsend edit1, ^{end}, Server
          gosub, resend
   ;ShowRecieved =
        }
    }
    return 1
}

SendData(wParam,SendData)
{
socket := wParam
;fileappend, %socket%`n,Settings\testing.txt
SendDataSize := VarSetCapacity(SendData)
SendDataSize += 1
sendret := DllCall("Ws2_32\send", "UInt", socket, "Str", SendData, "Int", SendDatasize, "Int", 0)
;send( sockConnected,> welcome, strlen(welcome) + 1, NULL);
}

redirects:
;msgbox %Showrecieved%
ifinstring, Showrecieved, DOLOGIN1
{
;msgbox %Showrecieved%
StringSplit, recievedx, Showrecieved,@
Stringreplace, recievedx2, recievedx2, DOLOGIN1
Stringreplace, recievedx2, recievedx2,%a_space%
iniread, pass,Settings\users.ini, Users, %recievedx1%
data:=recievedx2
;msgbox %pass%=%data%
if ( pass = data )
{
ShowRecieved=
(
LOGO%logo%
)
;return
}
else
{
ShowRecieved=%recievedx1% notvaliduserorpass!

;ShowRecieved=SR1NONUSER:
;sssssss=
;return
}
return
}

ifinstring, Showrecieved, kicked!
{
return
}
ShowRecieved2=%ShowRecieved%
;msgbox %ShowRecieved2%
Stringreplace, Showrecieved2, Showrecieved2, %A_Space%, `n,
filedelete,Settings\usertemp.txt
fileappend, %ShowRecieved2%,Settings\usertemp.txt
filereadline, name1,Settings\usertemp.txt,1
filereadline, cord,Settings\usertemp.txt,2
filedelete,Settings\usertemp.txt
if cord=connected!
{
fileappend, %name1%`n, Settings\userlist.txt
fileread, userlist, Settings\userlist.txt
guicontrol,,chatlist, %userlist%
stringreplace,userlist,userlist,`n,*,All
sleep, 500
Sendtext=SR1CLIENTADDLIST%userlist%
gosub, send1
name1=
cord=
return
}
/*
if cord=notvaliduserorpass!
{
Sendtext=SR1NONUSER
gosub, send1
name1=
cord=
return
}
*/
if cord=disconnected!
{
fileread, dellist,Settings\userlist.txt
stringreplace, dellist2, dellist, %name1%`r`n
filedelete, Settings\userlist.txt
fileappend, %dellist2%,Settings\userlist.txt
fileread, userlist,Settings\userlist.txt
guicontrol,,chatlist, %userlist%
stringreplace,userlist,userlist,`n,*,All
Sendtext=SR1CLIENTADDLIST%userlist%
gosub, send1
name1=
cord=
return
}
ifinstring, Showrecieved,/reg
{
;msgbox %Showrecieved%
Stringreplace, Showrecieved, Showrecieved,/reg
StringSplit, recievedx, Showrecieved,%a_space%
StringSplit, recievedx2, Showrecieved,@,%a_space%
iniread, isuser,Settings\users.ini, Users, %recievedx21%
if isuser<> ERROR
ShowRecieved=%recievedx21% is already a registered user!
else
{
if isuser= recievedx22
ShowRecieved=%recievedx21% you are already registered!
else
{
iniwrite, %recievedx22%,Settings\users.ini, Users,%recievedx21%
ShowRecieved=%recievedx21% is now a registered user!
}
}
return
}
ifinstring, Showrecieved,/w
return



InsertInteger(pInteger, ByRef pDest, pOffset = 0, pSize = 4)
{
    Loop %pSize% 
        DllCall("RtlFillMemory", "UInt", &pDest + pOffset + A_Index-1, "UInt", 1, "UChar", pInteger >> 8*(A_Index-1) & 0xFF)
}

kick_player:
gui, submit, nohide
guicontrol,,kicknick,
ref=
Sendtext=RX2KICKPLAYER%kicknick%
gosub, send1
sleep, 500
fileread, dellist,Settings\userlist.txt
stringreplace, dellist2, dellist, %kicknick%|
filedelete,Settings\userlist.txt
fileappend, %dellist2%,Settings\userlist.txt
fileread, userlist,Settings\userlist.txt
guicontrol,,chatlist, |%userlist%
stringreplace,userlist,userlist,|,*,All
Sendtext=SR1LOGIN0SR1CLIENTADDLIST%userlist%
gosub, send1
sendtext=
name1=
kicknick=
cord=
return

restart:
filedelete,Settings\server.txt
filedelete,Settings\userlist.txt
DllCall("Ws2_32\WSACleanup")
reload

editlogo:
;msgbox,16,Server, You have to restart the app before the logo changes work!
gui,10: +owner
gui,10: color, %colordef%
xlogo:=Dec_Hex(logo)
Gui,10: Add, Edit, x6 y7 w420 h230 veditlogo, %xlogo%
Gui,10: Add, Button, x6 y247 w160 h20 gcancelbtn, Cancel
Gui,10: Add, Button, x246 y247 w170 h20 gsavebtn, Save
; Generated using SmartGUI Creator 4.0
Gui,10: Show, x131 y91 h274 w437,Edit Server Logo
Return

cancelbtn:
gui 10:destroy
return

savebtn:
gui 10:submit, nohide
logo:=Enc_Hex(editlogo)
filedelete , Settings\logo.txt
fileappend ,%logo%,Settings\logo.txt
gui,10:destroy
return


usropt:
If A_GuiEvent=DoubleClick
{
Menu, MyMenu, Add, Kick, kick
Menu, MyMenu, Show
}
return

kick:
Gui,Submit,NoHide
kicknick=%chatlist%
Sendtext=Admin is kicking %kicknick%
gosub, send1
sleep, 5000
ref=
Sendtext=RX2KICKPLAYER%kicknick%
gosub, send1
sleep, 500
fileread, dellist,Settings\userlist.txt
stringreplace, dellist2, dellist, %kicknick%|
filedelete,Settings\userlist.txt
fileappend, %dellist2%,Settings\userlist.txt
fileread, userlist,Settings\userlist.txt
guicontrol,,chatlist, |%userlist%
stringreplace,userlist,userlist,|,*,All
Sendtext=SR1LOGIN0SR1CLIENTADDLIST%userlist%
gosub, send1
sendtext=
name1=
kicknick=
cord=
return


Exit:
exitapp
ExitSub: 
gui, submit, nohide
if chatlist=
{
goto, end
}
Msgbox, 48, Server, Server will shut down 5 second(s) after you hit ok!
gui, destroy
Sendtext= Server is Shutting down in 5 Second(s)
gosub, send1
sleep, 5000
end:
filedelete,Settings\server.txt
filedelete,Settings\userlist.txt
DllCall("Ws2_32\WSACleanup")
ExitApp

guiclose:
filedelete,Settings\userlist.txt
filedelete,Settings\server.txt
exitapp

kill:
kill_cons()
return

startsvr:
reload
return

Enc_Hex(x) ;originally: String2Hex(x) ; Convert a string to hex digits (modified to accommodate new line chars)
{
   prevFmt = %A_FormatInteger%
   SetFormat Integer, H ; this function requires hex format
   Loop Parse, x
      hex .= 0x100+Asc(A_LoopField)
   StringReplace hex, hex, 0x1,,All
   SetFormat Integer, %prevFmt% ; restore original integer formatting
   Return hex
}

Dec_Hex(x) ;originally: Hex2String(x) ; Convert a huge hex number to string (modified to suit String2Hex above)
{
   Loop % StrLen(x)/2
   {
      Pos:=(A_Index-1)*2+1
      StringMid hex, x, Pos, 2
      string := string . Chr("0x" hex)
   }
   Return string
}

kill_cons()
{
DllCall("Ws2_32\WSACleanup")
guicontrol,,chat, Server status: OFFLINE
guicontrol,,chatlist,
filedelete,Settings\userlist.txt
filedelete,Settings\server.txt
guicontrol, hide, SendText
guicontrol, hide, SendviaNet
guicontrol, show, startsvr
DllCall("ws2_32\closesocket", "uint", socket)
}



CLIENT
Code:
;#singleinstance force
#singleinstance off
#Persistent
#MaxMem 256
;#notrayicon
ifnotexist,Settings
{
Filecreatedir,Settings
}
configurex=1
menu, tray, icon, %A_Windir%\system32\narrator.exe
menu, tray, nostandard
menu, tray, add, Hide
menu, tray, add, Configure
menu, tray, add, Exit
filedelete,Settings\i2l.txt
filedelete,Settings\usernamestemp.txt


on=0
checkornot=0
con=0
end=0
las=1
ClientName=Anonimus
ClientPass=password
Network_Address = 127.0.0.1
Network_Port = 1000
ifexist,Settings\clientinfo.ini
{
iniread, Network_address,Settings\clientinfo.ini, Info, ip
iniread, Network_port,Settings\clientinfo.ini, Info, port
iniread, ClientName,Settings\clientinfo.ini, User, name
iniread, ClientPass,Settings\clientinfo.ini, User, pass
}
else
{
iniwrite, %Network_address%,Settings\clientinfo.ini, Info, ip
iniwrite, %Network_port%,Settings\clientinfo.ini, Info, port
iniwrite, Anonimus,Settings\clientinfo.ini, User, name
iniwrite, password,Settings\clientinfo.ini, User, pass
}
menu, tray, tip, Currently Set to`nIP: %Network_Address%`nPort: %Network_Port%


colordef=C0C0C0
gui, color, %colordef%
gui:
stringmid, clientname, clientname, 0, 12
Gui, Add, Edit, x6 y5 w260 h140 readonly vchat,
Gui, Add, Edit, x6 y155 w300 h20 vSendText,
Gui, Add, Button, x316 y155 w70 h20 vhide ghide, HIDE
Gui, Add, Edit, x6 y185 w100 h20 limit12 vClientName, %ClientName%
Gui, Add, Edit, x115 y185 w130 h20 limit12 vClientPass password, %ClientPass%
Gui, Add, Button, x335 y185 w50 h20 vsendbutton gSendviaNet, Send
Gui, Add, Button, x255 y185 w70 h20 vconnect gConnection_Init, Connect
Gui, Add, Edit, x276 y5 w110 h140 readonly vuserlistin,
Gui, Add, Button, x316 y185 w70 h20 vedit gdisconn, Log Off
;Menu, OptionsMenu, Add, &Hide    Ctrl+H, Hide
;Menu, OptionsMenu, Add, &Configure,Configure
;Menu, FileMenu, Add, E&xit, Exit
;Menu, MyMenuBar, Add, &File, :FileMenu 
;Menu, MyMenuBar, Add, &Options, :OptionsMenu
;Gui, Menu, MyMenuBar
guicontrol, hide, edit
Gui, Show, h218 w394, Client - Username: %ClientName%
WinGet Gui_ID, ID, Client
guicontrol,,chat, Welcome to your Chat Client!`n`nTo set a different port or IP address in which to connect to you can right click the Icon in your System Tray then click "Configure"`nYou can also type /features to read about all the features your Chat Client has!

return

Configure:
if configurex=1
{
gui, 3:color, C0C0C0
Gui, 3:Add, Edit, x6 y5 w110 h20 vip, %Network_address%
Gui, 3:Add, Text, x119 y8 w60 h20 , IP Address
Gui, 3:Add, Edit, x6 y25 w110 h20 vport, %Network_port%
Gui, 3:Add, Text, x119 y28 w30 h20 , Port
Gui, 3:Add, Button, x26 y55 w110 h20 , Save
Gui, 3:Show, h80 w175, Configure
}
else
msgbox,,Client,Connection configuration is available only if disconnected!
Return

3buttonsave:
gui, 3:submit, nohide
gui, 3:destroy
Network_Address=%ip%
Network_port=%port%
menu, tray, tip, Currently Set to`nIP: %Network_Address%`nPort: %Network_Port%
iniwrite, %Network_address%,Settings\clientinfo.ini, Info, ip
iniwrite, %Network_port%,Settings\clientinfo.ini, Info, port

return

3GuiClose:
gui, 3:destroy
return

hide:
if hide<>0
{
hide=0
gui,hide
}
else
{
hide=1
Gui, Show, h218 w394, Client
}
return

check:
if on=0
{
Settimer,check,off
return
}
if on=1
{
ifnotinstring, userlist, %Clientname%
{
Settimer,check,off
Msgbox, 16, Client, Secure Link Could not be established. Please Restart Client
exitapp
}
Settimer,check,off
}

$numpadenter::
ifwinactive, WinSock Chat Client
{
goto, SendviaNet
}
else
send, {NUMPADENTER}
return


$Enter::
ifwinactive, Client
{
goto, SendviaNet
}
else
send, {ENTER}
return

$UP::
ifwinactive, Client,
{
if las=1
{
guicontrol,,sendtext, %lasttype%
ControlSend Edit2, ^{End}, Client
envadd, las, 1
return
}
if las=2
{
guicontrol,,sendtext, %lasttype2%
ControlSend Edit2, ^{End}, Client
envadd, las, 1
return
}
if las=3
{
guicontrol,,sendtext, %lasttype3%
ControlSend Edit2, ^{End}, Client
envadd, las, 1
return
}
if las=4
{
guicontrol,,sendtext, %lasttype4%
ControlSend Edit2, ^{End}, Client
envadd, las, 1
return
}
if las=5
{
guicontrol,,sendtext, %lasttype5%
ControlSend Edit2, ^{End}, Client
return
}
}
else
send, {UP}
return

$DOWN::
ifwinactive, Client,
{
if las=1
{
guicontrol,,sendtext,
return
}
if las=2
{
guicontrol,,sendtext, %lasttype%
ControlSend Edit2, ^{End}, Client
envsub, las, 1
return
}
if las=3
{
guicontrol,,sendtext, %lasttype2%
ControlSend Edit2, ^{End}, Client
envsub, las, 1
return
}
if las=4
{
guicontrol,,sendtext, %lasttype3%
ControlSend Edit2, ^{End}, Client
envsub, las, 1
return
}
if las=5
{
guicontrol,,sendtext, %lasttype4%
ControlSend Edit2, ^{End}, Client
envsub, las, 1
return
}
}
else
send, {DOWN}
return

Connection_Init:
configurex=0
gui, submit, nohide
iniwrite, %ClientName%,Settings\clientinfo.ini, User, name
iniwrite, %ClientPass%,Settings\clientinfo.ini, User, pass
guicontrol, show, edit
ifinstring, Clientname, %A_Space%
{
Msgbox, 16, Client, You cannot use spaces in your name!
return
}
ifinstring, Clientname, *
{
Msgbox, 16, Client, You cannot use asteriks in your name!
return
}
ifinstring, Clientname, RX2
{
Msgbox, 16, Client, You cannot use that in your name!
return
}
ifinstring, Clientname, SR1
{
Msgbox, 16, Client, You cannot use that in your name!
return
}
ifinstring, Clientname, :
{
Msgbox, 16, Client, You cannot use colons in your name!
return
}
ifinstring, Clientname, $
{
Msgbox, 16, Client, $ is reserved for ChatServer Prefix.`n %A_Space%  %A_Space% %A_Space% %A_Space%%A_Space% %A_Space%You may not use it!
return
}
if Clientname=Console
{
Msgbox, 16, Client,
(
%A_Space%%A_Space%%A_Space%%A_Space%Please choose a nickname to use while chatting in this server.
             You are limited to 12 characters in your nickname.
You will be prevented from using certain characters in your nickname.
)
return
}
ifinstring, ClientPass, %A_Space%
{
Msgbox, 16, Client, You cannot use spaces in your pass!
return
}
ifinstring, ClientPass, *
{
Msgbox, 16, Client, You cannot use asteriks in your pass!
return
}
ifinstring, ClientPass, RX2
{
Msgbox, 16, Client, You cannot use that in your pass!
return
}
ifinstring, ClientPass, SR1
{
Msgbox, 16, Client, You cannot use that in your pass!
return
}
ifinstring, ClientPass, :
{
Msgbox, 16, Client, You cannot use colons in your pass!
return
}
ifinstring, ClientPass, $
{
Msgbox, 16, Client, $ is reserved for ChatServer Prefix.`n %A_Space%  %A_Space% %A_Space% %A_Space%%A_Space% %A_Space%You may not use it!
return
}
if ClientPass=Console
{
Msgbox, 16, Client,
(
%A_Space%%A_Space%%A_Space%%A_Space%Please choose a nickpass to use while chatting in this server.
             You are limited to 12 characters in your nickpass.
You will be prevented from using certain characters in your nickpass.
)
return
}
;menu, tray, delete, Configure
guicontrol,,chat,
guicontrol, enable, edit
;guicontrol, disable, edit
guicontrol,hide, connect
guicontrol, hide, clientname
guicontrol, hide, clientpass
guicontrol, move, sendbutton, x6 y185 w300 h20
OnExit, ExitSub




socket := ConnectToAddress(Network_Address, Network_Port)
if socket = -1
{

msgbox Error connecting to server! This program will now exit!
    ExitApp
   }

Process, Exist 
DetectHiddenWindows On
ScriptMainWindowId := WinExist("ahk_class AutoHotkey ahk_pid " . ErrorLevel)
DetectHiddenWindows Off


NotificationMsg = 0x5555  ; An arbitrary message number, but should be greater than 0x1000.
OnMessage(NotificationMsg, "ReceiveData")

menu, tray, tip, Currently connected to`nIP: %Network_Address%`nPort: %Network_Port%

FD_READ = 1     ; Received when data is available to be read.
FD_CLOSE = 32   ; Received when connection has been closed.
if DllCall("Ws2_32\WSAAsyncSelect", "UInt", socket, "UInt", ScriptMainWindowId, "UInt", NotificationMsg, "Int", FD_READ|FD_CLOSE)
{
    MsgBox % "WSAAsyncSelect() indicated Winsock error " . DllCall("Ws2_32\WSAGetLastError")
    ExitApp
}
sendtext=%ClientName%@%ClientPass% DOLOGIN1
gosub send1
return

SendviaNet:
Gui, Submit, NoHide
lasttype5=%lasttype4%
lasttype4=%lasttype3%
lasttype3=%lasttype2%
lasttype2=%lasttype%
lasttype=%sendtext%
stringgetpos, count2, sendtext, /, L
if count2=0
{
if sendtext=/features
{
if con=1
{
tooltip, That command is only available when not connected!, 220, 180
guicontrol,,sendtext,
Settimer, removetooltip, 4000
return
}
if con=0
{
guicontrol,,sendtext,
Guicontrol,,Chat,
(
Chat Client Features List:

Winsock chat communication
Connected and Disconnected messages
User List
Kick users (server only)
IP grabber (server only)
Command mode
 - Ping
 - IP2Location
 - VisitWeb
Configure Connection Menu
Hit 'Enter' = Quick Send
Hit 'UP' = Show Last Sent (Up to 5)
Hit 'DOWN' = Scroll Down on Last Sent (Clear if on last sent)
)
return
}
}

if Sendtext=/cmd
{
if con=1
{
tooltip, Command mode only available when not connected!, 220, 180
guicontrol,,sendtext,
Settimer, removetooltip, 4000
return
}
if con=0
guicontrol,,sendtext,
guicontrol,,chat, Command Mode Enabled!`n`n          Available commands are as follows`nPing - /cmd ping (ip/hostname)`nIP2Location - /cmd i2l (ip)`nVisitWeb - /cmd vw (url)`n`nCommand Usage:`nPing Command- Type in the syntax and fill in the "(ip/hostname)" with an IP or hostname.`nIP2Location Command- Type in the syntax and fill in the "(ip)" with an IP you want located. The script will require Internet access to check with the Whois website.`nYou can also leave the "(ip)" blank, and it will display your current location.`nVisitWeb Command- Write out the syntax and fill in the (url) for a URL you wish to go to.`n/info Informations about server and client
return
}


ifinstring, sendtext, /reg
{
if con=1
   {
   Gui,Submit,NoHide
   guicontrol,,sendtext,
   ;msgbox %sendtext%
;
      if sendtext=/reg
   guicontrol,,chat, Command usage:`n /reg username@pass
   else
   gosub send1
   return
   }
}
;if Sendtext=/sendfile
;{
;gosub sendfile
;return
;}

ifinstring, sendtext, /w
{
if con=1
   {
   ifinstring, sendtext, /w %ClientName%
   {
    guicontrol,,sendtext,
   guicontrol,,chat, Command usage:`n /w username`n YOU CAN NOT PM YOURSELF DUMBASS!
   }
   else
   {
   Gui,Submit,NoHide
   
   guicontrol,,sendtext,
   StringSplit, wisp,sendtext,%A_space%
      if sendtext=/w
   guicontrol,,chat, Command usage:`n /w username
   else
   {
   sendtext=/w %ClientName%@%wisp2%@Requested PM
   SendData(socket,sendtext)
   sendtext=
   }
   return
   }
   return
   }
}

if Sendtext=/info
{
if con=1
   {
   Gui,Submit,NoHide
   guicontrol,,sendtext,
   hfe=%userlist%
   stringreplace, hfe, hfe, |,`n,ALL
guicontrol,,chat, Currently connected to`nIP: %Network_Address%`nPort: %Network_Port%`nwith nick name: %Clientname%`nYour IP: %A_IPAddress1%`n_______________________________`n`nUsers Online: `n %hfe%_______________________________
return
   }
if con=0
   {
   Gui,Submit,NoHide
   guicontrol,,sendtext,
   guicontrol,,chat, Current server info`nIP: %Network_Address%`nPort: %Network_Port%`nConnecting with nick name: %Clientname% `nYour IP: %A_IPAddress1%`n_______________________________
return
   }
}
ifinstring, sendtext, /cmd ping
{
if con=1
   {
tooltip, Command mode only available when not connected!, 220, 180
guicontrol,,sendtext,
Settimer, removetooltip, 4000
return
   }
if con=0
   {
ping=%sendtext%
guicontrol,,sendtext,
guicontrol,,chat, Starting ping now`nPlease wait for results...
stringreplace, ping2, ping, /cmd,
stringreplace, ping3, ping2, ping,
stringreplace, ping4, ping3, %A_space%,
filedelete,Settings\pinger.bat
filedelete,Settings\Pinglog.txt
detecthiddenwindows, on
loop,
{
Process, close, cmd.exe
Process, exist, cmd.exe
if errorlevel=0
break
}
fileappend,
(
cd\
ping -n 3 %ping4% >> "Settings\Pinglog.txt"
),Settings\pinger.bat
run, pinger.bat,Settings\, hide useerrorlevel,
if errorlevel=ERROR
{
guicontrol,,chat, Could not run ping execution file!
return
}
loop,
{
Process, exist, cmd.exe,
if errorlevel=0
break
}
detecthiddenwindows, off
fileread, outping,Settings\Pinglog.txt
guicontrol,, chat, %outping%
ControlSend Edit1, ^{End}, Client
filedelete,Settings\pinger.bat
filedelete,Settings\Pinglog.txt
return
   }
}
ifinstring, sendtext, /cmd i2l
{
if con=1
   {
tooltip, Command mode only available when not connected!, 220, 180
guicontrol,,sendtext,
Settimer, removetooltip, 4000
return
   }
if con=0
{
i2l=%sendtext%
guicontrol,,sendtext,
guicontrol,,chat,Starting IP2Location Function`nPlease wait for results...
stringreplace, i2l2, i2l, /cmd,
stringreplace, i2l3, i2l2, i2l,
stringreplace, i2l4, i2l3, %A_space%,
;stringtrimleft, i2l4, i2l4, 1
filedelete,Settings\1.txt
stringreplace, ip2, i2l4, -, ., All
ip=%ip2%
urldownloadtofile, http://www.dnsstuff.com/tools/whois.ch?ip=%ip%,Settings\1.txt
fileread, 1,Settings\1.txt
StringGetPos, 2, 1, Location:
stringmid, 3, 1, %2%,
stringreplace, 4, 3, ], `n, All
filedelete,Settings\2.txt
fileappend, %4%,Settings\2.txt
filereadline, 5,Settings\2.txt, 2
bl=
stringreplace, 6, 5, Location:, %bl%, All
filedelete,Settings\2.txt
filedelete,Settings\1.txt

if 6=<html xmlns="http://www.w3.org/1999/xhtml">
{
guicontrol,,chat, Could not locate IP!
return
}
if ip=
{
ip=%A_Ipaddress1%
}
fileappend, %ip% found at%6%]`n,Settings\i2l.txt
fileread, i2lout,Settings\i2l.txt
guicontrol,,chat, %i2lout%
return
}
}
ifinstring, sendtext, /cmd vw
{
if con=1
   {
tooltip, Command mode only available when not connected!, 220, 180
guicontrol,,sendtext,
Settimer, removetooltip, 4000
return
   }
if con=0
{
vw=%sendtext%
guicontrol,,sendtext,
guicontrol,,chat,Visiting address now...
stringreplace, vw2, vw, /cmd,
stringreplace, vw3, vw2, vw,
stringreplace, vw4, vw3, %A_space%,
stringtrimleft, vw4, vw4, 1
run, %vw4%,, useerrorlevel
if ERRORlevel=ERROR
{
Guicontrol,,chat,Error when visiting address (%vw4%)`nThis is sometimes caused with having Firefox as your default browser`nIf this is the case, ignore this error, and firefox will open normally.
return
}
Guicontrol,,chat,Address Visited!
return
}
}
}
if Sendtext=
{
return
}
if Sendtext=%A_Space%
{
tooltip, You cannot send blank lines!, 220, 180
guicontrol,,sendtext,
Settimer, removetooltip, 4000
return
}
if Sendtext=%A_Space%%A_Space%
{
tooltip, You cannot send blank lines!, 220, 180
guicontrol,,sendtext,
Settimer, removetooltip, 4000
return
}
ifinstring, Sendtext, %A_Space%%A_Space%%A_Space%
{
tooltip, Too many consecutive spaces!, 220, 180
guicontrol,,sendtext,
Settimer, removetooltip, 4000
return
}
ifinstring, SendText, RX2CLIENTCON:
{
tooltip, You cannot send that text!, 220, 180
guicontrol,,sendtext,
Settimer, removetooltip, 4000
return
}
ifinstring, sendtext, DOLOGIN1
{
tooltip, You cannot send that text!, 220, 180
guicontrol,,sendtext,
Settimer, removetooltip, 4000
return
}

SendText =%ClientName%: %SendText%

guicontrol,,SendText,

send1:
SendData(socket,SendText)
SendText =
return

RemoveToolTip:
SetTimer, RemoveToolTip, Off
ToolTip
return

ConnectToAddress(IPAddress, Port)
{
    VarSetCapacity(wsaData, 32) 
    result := DllCall("Ws2_32\WSAStartup", "UShort", 0x0002, "UInt", &wsaData)
    if ErrorLevel
    {
        MsgBox WSAStartup() could not be called due to error %ErrorLevel%. Winsock 2.0 or higher is required.
        return -1
    }
    if result 
    {
        MsgBox % "WSAStartup() indicated Winsock error " . DllCall("Ws2_32\WSAGetLastError")
        return -1
    }


    AF_INET = 2
    SOCK_STREAM = 1
    IPPROTO_TCP = 6
    socket := DllCall("Ws2_32\socket", "Int", AF_INET, "Int", SOCK_STREAM, "Int", IPPROTO_TCP)
    if socket = -1
    {
        MsgBox % "socket() indicated Winsock error " . DllCall("Ws2_32\WSAGetLastError")
        return -1
    }

   
    SizeOfSocketAddress = 16
    VarSetCapacity(SocketAddress, SizeOfSocketAddress)
    InsertInteger(2, SocketAddress, 0, AF_INET) 
    InsertInteger(DllCall("Ws2_32\htons", "UShort", Port), SocketAddress, 2, 2)   
    InsertInteger(DllCall("Ws2_32\inet_addr", "Str", IPAddress), SocketAddress, 4, 4)   

   
    if DllCall("Ws2_32\connect", "UInt", socket, "UInt", &SocketAddress, "Int", SizeOfSocketAddress)
    {
        MsgBox % "connect() indicated Winsock error " . DllCall("Ws2_32\WSAGetLastError") . "?"
        return -1
    }
    return socket 
}


ReceiveData(wParam, lParam)
{
Critical
   global ShowRecieved, pmchat , pmedit
    socket := wParam
    ReceivedDataSize = 4096 
    Loop
    {
        VarSetCapacity(ReceivedData, ReceivedDataSize, 0) 
        ReceivedDataLength := DllCall("Ws2_32\recv", "UInt", socket, "Str", ReceivedData, "Int", ReceivedDataSize, "Int", 0)
        if ReceivedDataLength = 0   
            ExitApp 
        if ReceivedDataLength = -1
        {
            WinsockError := DllCall("Ws2_32\WSAGetLastError")
            if WinsockError = 10035 
                return 1
            if WinsockError <> 10054
             
              MsgBox % "recv() indicated Winsock error " . WinsockError
            ExitApp 
        }
   logos=0
        Loop, parse, ReceivedData, `n, `r
        {

gui, submit, nohide
            ShowRecieved = %ShowRecieved%%A_LoopField% 
settimer, check, 2500
   ifnotinstring, Showrecieved, connected
   {
ifnotinstring, Showrecieved, :
   {
   gosub, adddellist

   }
if ShowRecieved= RX2CLIENTCON:
   {
   gosub, connectpend
   gosub, turnon
   sleep, 250
   con=1
   logos=0
   return
   }
   /*
if ShowRecieved= SR1NONUSER:
   {
   if con = 1
   {
Msgbox, 48, Info, Server returned: Not A Valid User Or Incorect Password!
gosub disconn
}
   return
   }
 */ 
ifinstring , Showrecieved, LOGO
{
;logo:=Dec_Hex(logo)
ifnotexist , Settings\client.logo
{
Stringreplace, logo, Showrecieved, LOGO
logo:=Dec_Hex(logo)
filedelete , Settings\client.txt
fileappend, %logo%`n,Settings\client.logo
fileappend, %logo%`n, Settings\client.txt
 fileread, chat1,Settings\client.logo
   guicontrol,,chat, %chat1%
    ShowRecieved =
          return 1
;msgbox logo
;Guicontrol,,chat,logo
;Showrecieved=
}
Showrecieved=
return 1
}

}

if ShowRecieved <>
{
;msgbox %ShowRecieved%
 fileappend, %ShowRecieved%`n, Settings\client.txt
   fileread, chat1, Settings\client.txt
   guicontrol,,chat, %chat1%
    ShowRecieved =
        ControlSend Edit1, ^{End}, Client
   ifwinnotactive, Client
   {
   Soundplay, %a_windir%\Media\chimes.wav
   }
   }
        }
    }
    return 1 
}


SendData(wParam,SendData)
{
socket := wParam
SendDataSize := VarSetCapacity(SendData)
SendDataSize += 1
sendret := DllCall("Ws2_32\send", "UInt", socket, "Str", SendData, "Int", SendDatasize, "Int", 0)
;send( sockConnected,> welcome, strlen(welcome) + 1, NULL);
}

turnon:
on=1
return

adddellist:
ShowRecieved2=%ShowRecieved%
ifinstring, Showrecieved2, RX2KICKPLAYER
{
stringreplace, Showrecieved2, Showrecieved2, RX2KICKPLAYER,-,All
if Showrecieved2=-%clientname%
   {
gosub, kickexit
   }
Showrecieved=
exit
}
ifinstring, ShowRecieved2, connected!
{
showrecieved2=
return
}
ifinstring, ShowRecieved2,%clientname%%a_space%notvaliduserorpass
{
showrecieved2=
Msgbox, 48, Info, Server returned: Not A Valid User Or Incorect Password!
exitapp
}
   ifinstring, ShowRecieved,notvaliduserorpass!
{
showrecieved=
return
}

ifinstring, Showrecieved2, /w
{
ifinstring, Showrecieved2, @%ClientName%@
   {
   ;msgbox pm
   gosub wispermenu
   Stringreplace, rcvtxt, Showrecieved2, /w%a_space%
   StringSplit, wisp4me,rcvtxt,@
   if wisp4me3<>
   {
   fileappend, %wisp4me1%: %wisp4me3%`n, Settings\pmchat.txt
   fileread, wispmsg, Settings\pmchat.txt
   guicontrol,55:,pmchat,%wispmsg%
   }

   }
        ShowRecieved=
    Showrecieved2=
   return
   }


ifinstring, Showrecieved2, SR1CLIENTADDLIST
{
filedelete, Settings\userlistc.txt
stringreplace, ShowRecieved2, ShowRecieved2, SR1CLIENTADDLIST,,ALL
stringreplace, ShowRecieved2, ShowRecieved2, *,`n, All
fileappend, %ShowRecieved2%, Settings\userlistc.txt
fileread,  userlist, Settings\userlistc.txt
;stringreplace, userlist2, userlist, *, `n, ALL
guicontrol,,userlistin, %userlist%
userlist2=%userlist%
stringreplace, userlist2, userlist2, %clientname%, %A_Space%
fileappend, %userlist2%, Settings\usernamestemp.txt
if checkornot=0
{
Loop, read,Settings\usernamestemp.txt
{
    last_line := A_LoopReadLine
if last_line=%clientname%
{
guicontrol,,userlistin,
sleep, 500
nam=1
exitapp
}
}
checkornot=1
}
filedelete,Settings\usernamestemp.txt
ShowRecieved=
ShowRecieved2=
exit
}
ShowRecieved2=
return

connectpend:
ShowRecieved=
if con=0
{
SendText=%Clientname% connected!
gosub, Send1
con=1
return
}
else
return

InsertInteger(pInteger, ByRef pDest, pOffset = 0, pSize = 4)

{
    Loop %pSize% 
        DllCall("RtlFillMemory", "UInt", &pDest + pOffset + A_Index-1, "UInt", 1, "UChar", pInteger >> 8*(A_Index-1) & 0xFF)
}



ExitSub: 

if nam=1
{
sleep, 500
}
open= %Clientname% disconnected!
SendData(socket,open)
sleep, 250
gui, destroy
sleep, 250
DllCall("Ws2_32\WSACleanup")
;sleep, 2000
filedelete,Settings\userlistc.txt
filedelete,Settings\client.txt
filedelete,Settings\i2l.txt
filedelete,Settings\usernamestemp.txt
filedelete,Settings\pmchat.txt
filedelete , Settings\client.logo
if nam=1
{
Msgbox, 16, Client, Client name already in use!
exitapp
}
ExitApp

Kickexit:
gui, destroy
open= %Clientname% was kicked!
SendData(socket,open)
sleep, 500
DllCall("Ws2_32\WSACleanup")
Msgbox, 16, Client, You were kicked from the Server!
filedelete , Settings\client.logo
filedelete ,Settings\pmchat.txt
exitapp

disconn:
chat=
open= %Clientname% disconnected!
SendData(socket,open)
sleep, 250
;gui, destroy
sleep, 250
DllCall("Ws2_32\WSACleanup")
filedelete,Settings\i2l.txt
filedelete,Settings\usernamestemp.txt
on=0
checkornot=0
con=0
end=0
las=1
ifexist,Settings\clientinfo.ini
{
iniread, Network_address,Settings\clientinfo.ini, Info, ip
iniread, Network_port,Settings\clientinfo.ini, Info, port
}
menu, tray, tip, Currently Set to`nIP: %Network_Address%`nPort: %Network_Port%

Guicontrol,,Chat,
(
Chat Client Features List:

Winsock chat communication
Connected and Disconnected messages
User List
Kick users (server only)
IP grabber (server only)
Command mode
 - Ping
 - IP2Location
 - VisitWeb
Configure Connection Menu
Hit 'Enter' = Quick Send
Hit 'UP' = Show Last Sent (Up to 5)
Hit 'DOWN' = Scroll Down on Last Sent (Clear if on last sent)
)
guicontrol, hide, edit
guicontrol,show, connect
guicontrol, show, clientname
guicontrol, show, clientpass
guicontrol, move, sendbutton,  x335 y185 w50 h20
configurex=1
filedelete,Settings\userlistc.txt
filedelete,Settings\client.txt
filedelete,Settings\i2l.txt
filedelete,Settings\usernamestemp.txt
filedelete,Settings\pmchat.txt
filedelete , Settings\client.logo
guicontrol,,userlistin,
return

Guiclose:
filedelete,Settings\userlistc.txt
filedelete,Settings\client.txt
filedelete,Settings\i2l.txt
filedelete,Settings\usernamestemp.txt
filedelete , Settings\client.logo
gosub, exitsub

FileReadEx( ByRef V,F,B,O ) {
return varsetcapacity(v,b,0)-o+(h:=dllcall("_lopen",str,f,int,0))-h+dllcall("_llseek",uint
 ,h,uint,o,int,0)-dllcall("_lread",uint,h,str,v,int,b)+dllcall("_lclose",uint,h) ? -1 : &v     
}

sendfile(file,chunksize=10000)
{
FileGetSize, size, %file%
chunk:=size/chunksize
chunks:=Round(chunk)
StringSplit, final, chunk, .
lastsize:=size-chunks
finalbytes:=lastsize*chunksize
offset=0

lastoffset:=chunks*chunksize
loop, %chunks%
{
FileReadEx( Bin, file, chunksize,offset )   
offset:=%offset%+%chunksize%
SendData(socket,Bin)
Bins=%Bins%%Bin%
}
;msgbox %size%`n%lastsize%`n%finalbytes%`n%lastoffset%
FileReadEx( Bin, file, finalbytes,lastoffset )
SendData(socket,Bin)
Bins=%Bins%%Bin%
Guicontrol,,Chat,%Bins%
}

sendfile:
FileSelectFile, file , Options, , Select the file to send, *.*
;sendfile(file,10000)
sendfile(file)
return

wispermenu:
if isgui<>1
{
gui,55: color, %colordef%
Gui ,55:  Add, Edit, x6 y7 w380 h140 readonly vpmchat,
Gui,55:  Add, Edit, x6 y157 w300 h20 vpmedit,
Gui,55:  Add, Button, x326 y187 w50 h20 gmeclose, Exit
Gui,55: Add, Button, x6 y187 w300 h20 gsendpm, Send
Gui,55: Show, x440 y376 h218 w394, Private Message
isgui=1
}
Return

55guiclose:
isgui=0
gui, 55: destroy
filedelete,Settings\pmchat.txt
return

exit:
if con=0
{
exitapp
}
if con=1
{
goto, exitsub
}

meclose:
return

sendpm:
Gui,55: Submit,NoHide
guicontrol,55:,pmedit,
pm=/w %ClientName%@%wisp4me1%@%pmedit%
SendData(socket,pm)
fileappend, %ClientName%: %pmedit%`n, Settings\pmchat.txt
fileread, wispmsg, Settings\pmchat.txt
guicontrol,55:,pmchat,%wispmsg%
return


Enc_Hex(x) ;originally: String2Hex(x) ; Convert a string to hex digits (modified to accommodate new line chars)
{
   prevFmt = %A_FormatInteger%
   SetFormat Integer, H ; this function requires hex format
   Loop Parse, x
      hex .= 0x100+Asc(A_LoopField)
   StringReplace hex, hex, 0x1,,All
   SetFormat Integer, %prevFmt% ; restore original integer formatting
   Return hex
}

Dec_Hex(x) ;originally: Hex2String(x) ; Convert a huge hex number to string (modified to suit String2Hex above)
{
   Loop % StrLen(x)/2
   {
      Pos:=(A_Index-1)*2+1
      StringMid hex, x, Pos, 2
      string := string . Chr("0x" hex)
   }
   Return string
}

Comments , suggestions and bugs are more then welcomed


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Nice.
PostPosted: January 6th, 2009, 10:12 pm 
Offline

Joined: August 2nd, 2008, 12:31 am
Posts: 101
Wow, this gets better and better. I really like the fact that you've added passwords and users, no one can listen in! keep up the great work.

_________________
Woot.

Please read forum etiquette


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 7th, 2009, 5:58 am 
Offline

Joined: May 14th, 2008, 9:48 pm
Posts: 110
I noticed a bug in the new version you released.

When I opened the Server, and 1 client. I connected as Anonimus. Then I opened another client, and tried to connect as Anonimus. The second client didn't make the antihang feature and disconnected. Then the server recieved a disconnect message from Anonimus while my name was still Anonimus. It took Anonimus off the userlist, (it was never added twice btw), then the clients crashed.
________
Roll Blunts


Last edited by jmanx on February 10th, 2011, 9:38 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 7th, 2009, 7:37 am 
Very impressive!! 4 Stars! ****

I like the PM feature you added..., it really makes it robust and nice. Hope to see encryption, IpV6, and more soon, to make this truly the best script on the planet. ;) Very good work!!


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: January 8th, 2009, 2:41 am 
Offline

Joined: November 1st, 2007, 10:03 pm
Posts: 885
So, How do i set it up. I open port 1000 (Tried TCP and UDP)

And edited the server file. And i cant connect by my wan ip.

Also, GREAT work WankaUSR


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 9th, 2009, 10:25 am 
Offline

Joined: May 14th, 2008, 9:48 pm
Posts: 110
Added new version which I put in my own private messaging version.

Was just in a rush to put it out, going to append the current private messaging soon, expect updated version.

Future Updates:

More Elaborate Private Messaging
MD5 Hash checker
(Client gets MD5 hash of current client, then sends to server upon connecting. Server checks Hash to make sure it's the most updated client. If it's not, client gets forcefully disconnected [socket termination] and told to go get latest version)
________
MEDICAL MARIJUANA CARD


Last edited by jmanx on February 10th, 2011, 9:38 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 9th, 2009, 4:35 pm 
Offline

Joined: August 14th, 2007, 12:11 pm
Posts: 86
I was just thinking about some kind of compatibility check since if you start the sever and acces the ip http:\\127.0.0.1:1000 with a browser (server ip and port) it shows a download window :))


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 10th, 2009, 3:30 am 
Offline

Joined: May 14th, 2008, 9:48 pm
Posts: 110
After a few more updates me and WankaUSR intend to make, I will be hosting a fulltime Winsock server on one of the dedicated servers I own.

I didn't realize people wanted a server to talk in, I thought I was just releasing this project.

This server will be running the first WinSock Chat 1.0 version and same with the client. Only clients with 1.0 and up will be able to join. This server will also not be a test server for people to join and test custom versions of the winsock chat. Sometimes using incompatible versions or sending faulty messages screws up the server and requires it to be restarted in order to work properly. For this reason, you must have a COMPILED version of the client script to join the chat. (Server will regulate this)



Just wanted to say that and thanks for everyone (Fry) who still like this project.
________
MERCEDES-BENZ W116


Last edited by jmanx on February 10th, 2011, 9:38 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 16th, 2009, 12:08 am 
Offline

Joined: November 1st, 2007, 10:03 pm
Posts: 885
jmanx wrote:
Just wanted to say that and thanks for everyone (Fry) who still like this project.


Ha, Its not just me. Also with MD5 Hash Checker do we need WankaUSR's version or the one on the front page? I really like your Dedicated Server idea, post IP to join ASAP. Also I just cant seem to setup my own server, Any help?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 16th, 2009, 12:44 am 
Offline

Joined: May 14th, 2008, 9:48 pm
Posts: 110
Ports Open?

If you have a router and it's yours (like in your house and not sharing with a lot of people) set up your Host pc on DMZ

set server to 0.0.0.0

and client to connect as your external
________
Digital vaporizer


Last edited by jmanx on February 10th, 2011, 9:39 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 16th, 2009, 4:05 am 
Offline

Joined: November 1st, 2007, 10:03 pm
Posts: 885
Is it UDP or TCP?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 16th, 2009, 8:13 am 
Offline

Joined: May 14th, 2008, 9:48 pm
Posts: 110
umm TCP?

That's why the title says "TCP/IP Server+Client Chat Script (w/ Features)"
(not trying to be rude or anything)
________
Starcraft ii replays


Last edited by jmanx on February 10th, 2011, 9:39 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 17th, 2009, 4:19 am 
Offline

Joined: November 1st, 2007, 10:03 pm
Posts: 885
Lol, Pretty obvious, wonder if theres UDP/IP :lol:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 7th, 2010, 11:19 pm 
Offline

Joined: December 20th, 2007, 4:12 am
Posts: 22
I got a modified version to transfer txt files without making many alterations to the code. The file is just sent as a message with an unusual character that triggers the client to save the message as a file.

However, there is a pretty small limit as to how long the files can be. When they exceed a certain length the transfer fails because the text is broken up into separate sends. Is there a simple way to bump up the size of data sent in a single message?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 21st, 2010, 6:22 pm 
I have problem:
computer1: run Server
computer2: run Client, enter IP aaaaaaaaand -> "connect() indicated winsock error 10061?" :(
Use LAN. Ip server 192.168.2.2
Ip client 192.168.2.1


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 128 posts ]  Go to page Previous  1 ... 4, 5, 6, 7, 8, 9  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Yahoo [Bot] and 16 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group