Jump to content

server broken?


Recommended Posts

Hello everyone,

I coded a chat server sorta like a telnet application thing. It sends and receives text, but when I try to telnet in, it doesn't work.

Any help would be appriciated,

#NoTrayIcon

#include <file.au3>

#include <string.au3>

#include <inet.au3>

#include <constants.au3>

#include <ie.au3>

#include <misc.au3>

#include <process.au3>

#include <math.au3>

#include <guiconstants.au3>

const $version = "1.0b"

$ServerName=IniRead("config.ini", "server", "name", "TestChatServer-[Name not specified]")

if (ProcessExists(@ScriptName)) then

MsgBox(0+16, "Error!", "Only one instance of this program can be run at a time.")

exit

EndIf

if (FileExists("config.ini") == 0) then

MsgBox(0+16, "Error", "No configuration file was found.")

exit

EndIf

$ip=IniRead("config.ini", "server", "ip", 0)

if ($ip == 0) then

MsgBox(0+16, "Error!", "No IPaddress was spwcified.")

exit

EndIf

if ($ip == "dynamic") then

$ip=_GetIP()

EndIf

$port=IniRead("config.ini", "server", "port", 8860)

dim $connections[9]

$connections[0]=1

TCPStartup()

$listen=TCPListen($ip, $port)

while 1

$ccount=$connections[0]

if ($connections[0] < 8) then

$connections[$connections[0]]=TCPAccept($listen)

if ($connections[$connections[0]] > 0) then

SendStartup($connections[$connections[0]])

$connections[0]=$connections[0]+1

EndIf

EndIf

wend

func SendStartup($sock)

TCPSend($sock, "Connected to: "&$serverName&@crlf&"Server version: "&$version&@crlf&@crlf)

EndFunc

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