dnsi Posted October 24, 2006 Share Posted October 24, 2006 MULTIPLAYER-SOCKETSERVER All you have to do is change the 100 in $link[100] to the number of users you want to connect to your computer. The port is 9999. TCPStartup() Dim $link[100] $vvv=0 While $vvv<100 $link[$vvv]=-1 $vvv=$vvv+1 WEnd $main=TCPListen(@IPAddress1,9999) While 1=1 $i=0 While $i<100 If $link[$i]=-1 Then $link[$i]=TCPAccept($main) ExitLoop EndIf $i=$i+1 WEnd $j=0 While $j<100 If $link[$j]<>-1 Then $recv=TCPRecv($link[$j],10000) if $recv<>"" Then $ddd=0 While $ddd<100 If $link[$ddd]<>-1 Then TCPSend($link[$ddd],$recv) EndIf $ddd=$ddd+1 WEnd EndIf EndIf $j=$j+1 WEnd WEnd There you go. My Programs:Flip-Flop File Encryption SysyemMULTIPLAYER-SOCKETSERVERHide An Archive In A Picture Link to comment Share on other sites More sharing options...
Graymatter Posted October 24, 2006 Share Posted October 24, 2006 MULTIPLAYER-SOCKETSERVER Hi, A) What does i do ? Does it allow all pc games to be able to run multiple copies ? Even ones that check for duplicate copy run and terminate it ? Cough cough proxy cough [quote]I am so clever that sometimes I don't understand a single word of what I am saying.[/quote] Link to comment Share on other sites More sharing options...
dnsi Posted October 24, 2006 Author Share Posted October 24, 2006 This is a TCPSERVER that can surport many players at a time. The termaition is closing the process! My Programs:Flip-Flop File Encryption SysyemMULTIPLAYER-SOCKETSERVERHide An Archive In A Picture Link to comment Share on other sites More sharing options...
Graymatter Posted October 25, 2006 Share Posted October 25, 2006 (edited) Whoda buda whata? English for noobs please!! I mean i didnt understand was it a yes or no for my questions Just a server hosting or something ? or just checks total number of ppl connected to ur already hosted game server? Edited October 25, 2006 by Graymatter [quote]I am so clever that sometimes I don't understand a single word of what I am saying.[/quote] Link to comment Share on other sites More sharing options...
Helge Posted October 25, 2006 Share Posted October 25, 2006 - Does it allow all pc games to be able to run multiple copies ?Eehm.. What part of dnsi's post or code made you even think that ?- Checks total number of ppl connected to ur already hosted game server?Ost. Same as above.- Just a server hosting or something ?Well, that's more like it. Link to comment Share on other sites More sharing options...
Cubehead Posted October 25, 2006 Share Posted October 25, 2006 Hi dnsi, May be you could modify your code this way, to avoid the magic number (100 in this instance). TCPStartup() Dim Const $MAX_CONNECTIONS = 100 Dim $link[$MAX_CONNECTIONS] $vvv=0 While $vvv<$MAX_CONNECTIONS $link[$vvv]=-1 $vvv=$vvv+1 WEnd $main=TCPListen(@IPAddress1,9999) While 1=1 $i=0 While $i<$MAX_CONNECTIONS If $link[$i]=-1 Then $link[$i]=TCPAccept($main) ExitLoop EndIf $i=$i+1 WEnd $j=0 While $j<$MAX_CONNECTIONS If $link[$j]<>-1 Then $recv=TCPRecv($link[$j],10000) if $recv<>"" Then $ddd=0 While $ddd<$MAX_CONNECTIONS If $link[$ddd]<>-1 Then TCPSend($link[$ddd],$recv) EndIf $ddd=$ddd+1 WEnd EndIf EndIf $j=$j+1 WEnd WEnd Cubehead Link to comment Share on other sites More sharing options...
dnsi Posted October 25, 2006 Author Share Posted October 25, 2006 Good idea dude. My Programs:Flip-Flop File Encryption SysyemMULTIPLAYER-SOCKETSERVERHide An Archive In A Picture Link to comment Share on other sites More sharing options...
jvanegmond Posted October 26, 2006 Share Posted October 26, 2006 You can create a script that allows you to have infinite connections, using _ArrayAdd, _ArrayInsert and _ArrayDelete. I love those functions. github.com/jvanegmond Link to comment Share on other sites More sharing options...
dnsi Posted October 26, 2006 Author Share Posted October 26, 2006 Fix the code and post it. And you can only get 255 connections or the server overloads. My Programs:Flip-Flop File Encryption SysyemMULTIPLAYER-SOCKETSERVERHide An Archive In A Picture Link to comment Share on other sites More sharing options...
themax90 Posted October 27, 2006 Share Posted October 27, 2006 (edited) Perhaps my thread will enlighten you.http://www.autoitscript.com/forum/index.ph...c=20589&hl=To allow all possibilities, you should always have a variable like:CODEGlobal $MaxLength = 512; Or any other numberI often set it too 512000 because you never know what amount will come through streams.As for when you send too much, it is read then if you go over the maximum characters it USUALLY is picked up upon the second recv command as long as no other instance is sent in that .005 odd fraction of a second(if you made you TCP script correctly).Maximum buffer size :That is not completely known but the size is proportional to the amount of memory used. Consult the Helpfile on limitations too find it that is availible.Presumably, since you may get extra values that exceeded the maximum length, you could in theory, read character by character. I have NEVER attempted this and see no need for it, so you may attempt it, please check once again, the list of examples for the Optimized Server /w Client and modify the Client's accepting variable to 1 and see if it works.Maximum Connections :Basically, if you do not have it set, then the amount of connections is not set and only limited by the amount of variables you can use or how much you can keep track of. Maximum connection basically inforces a rule that if you exceed the MaxConc setting then your connection is refused. I do not know specifics, I have never tested it that far.Hopefully this helps you in your TCP thoughts.It is a decent start, but you're kinda reinventing the wheel to say. Many, many, many servers and test scripts have been made in the past year and AutoIt-ITS(involving TCP) is on hold again due to time restrictions. As soon as I get time the First 1.0 will be availible. But the reality of that happening isn't until christmas or maybe later.If this helps - great, if it doesn't - so be it.AutoIt Smith. Edited October 27, 2006 by AutoIt Smith Link to comment Share on other sites More sharing options...
dnsi Posted October 27, 2006 Author Share Posted October 27, 2006 Oh ok because i thought that the visualbasic version if the connection exceds 255 the server cannot handle it and crash. So... I thought C++ was the same. But i didn't know that you could do more. My Programs:Flip-Flop File Encryption SysyemMULTIPLAYER-SOCKETSERVERHide An Archive In A Picture Link to comment Share on other sites More sharing options...
clearguy Posted November 12, 2006 Share Posted November 12, 2006 (edited) Hi, I just started on TCP autoit functions, so I've done a mix with the help files to get an handy example. I'm just wondering why the recieved data is sent back (if I understand correctly) ? Maybe to be captured by an other process for making 'in-game' things... tell the client 'it's ok I recieved your data!' or I don't know !?! And would this loop : DO $main=TCPAccept(etc..) Until $main<>-1oÝ÷ Ø"ÈÔÚºÚ"µÍÐÓQS ÌÌÎÈÝYHYÝ[ÈHÑTTÌÌÎÉÌÌÎÉÌÌÎÉÌÌÎÉÌÌÎÉÌÌÎÉÌÌÎÉÌÌÎÉÌÌÎÉÌÌÎÉÌÌÎÉÌÌÎÉÌÌÎÉÌÌÎÉÌÌÎÂÈÙYHÔXÝ^[BÚ[ÛYH ÑÕRPÛÛÝ[Ë]LÉÝÂÈÝHÔÙXÙÂÏOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOBÔÝ BÈÙ]ÛÛYH]ØXH[ÂËKKKKKKKKKKKKKKKKKKKKKKKKKBÑ[H ÌÍÜÞÙÈHÛÛ][YBÈÙ] ÌÍÜÞTQTÔÈÈÚ]HÑTTËÙHÚ[Ú[ÙHHÈ[YH[È[TYÜÂ[H ÌÍÜÞTQTÔÈHTYÜÌB[H ÌÍÛÔHNNNBÈ[]X[^HHXXHÈÙ[HÛÛXÝ[ÛÏOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOB[H ÌÍÐÛÛXÝYÛØÚÙ]HLBÐ][ÈÛÛXÝÈÑTT]]ÈT[ÔÌÎLBÏOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOBÌÍÐÛÛXÝYÛØÚÙ]HÔÛÛXÝ ÌÍÜÞTQTÔË ÌÍÛÔ B[H ÌÍÜÞ]BÈYHÈ[ÜÚÝÈ]YÜ[ÙÐÞ LL ][ÝÑÜ][ÝË ][ÝÕÔÛÛXÝZ[YÚ]ÔÐHÜ ][ÝÈ [ÈÜBÈYHÈÈÜÛÜ[[]ÞÜ]BÈÈÙ[ÈHÑTT[ÙBÓÛÜÜ]ÚÚ[ÈÜ]HÈÙ[ÈHÑTTÚ[HBÈ[]ÞÜ]HÈ[ÛZ] ÌÍÜÞ]HH[]Þ ][ÝÑ]HÜÙ][ÝË [È [È ][ÝÑ[]HÈ[ÛZ]ÈHÑTT][ÝÊBÈY^HØ[Ù[H[]ÞÜX]H][ÈÙH^]ÝÜ]ÛÜYÜÜ ÌÍÜÞ]HH ][ÝÉ][ÝÈ[BBQ[H ÌÍÛÏPÜBBSÙÐÞ ÌÎNÉÌÎNË ÌÍÛÊBBBQ^]ÛÜBBQ[YÈÙHÚÝ[]H]H[ ÌÍÜÞ]K]È][ÈÙ[]ÝYÚÝÛÛXÝYÛØÚÙ]ÔÙ[ ÌÍÐÛÛXÝYÛØÚÙ] ÌÍÜÞ]JBÈYHÙ[Z[YÚ]Ü[HÛØÚÙ]ÈØÛÛXÝYËKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKBYÜ[^]ÛÜÑ[[Y Thanx for help me to understand little more:) EDIT: the $ddd variable is used to send the informations to all clients that are connected I read many scripts from AutoIt Smith and I have understood this one,so my questions are solved. Edited November 12, 2006 by clearguy I've never met anyone who codes binary. StringMultiInsert()SOW EncryptFrench autoit forum - forum français Link to comment Share on other sites More sharing options...
dnsi Posted November 19, 2006 Author Share Posted November 19, 2006 Let me give to a tut on TCP/IP. The server is where every message goes to. The server listens for a incomming connection. when it detects a client it accepts the client in. When a message comes in it needs to be distrubite to everyone in connection thus making a chatroom. The client connects then it sends teh message. When it recives a message it adds to the text field. There Hope You Understand It Better My Programs:Flip-Flop File Encryption SysyemMULTIPLAYER-SOCKETSERVERHide An Archive In A Picture Link to comment Share on other sites More sharing options...
jvanegmond Posted November 20, 2006 Share Posted November 20, 2006 The server has been built quite poor though. TCP functions have 2 or 3 standard-set ups and I think those should be built some time (When you know what they look like, they won't take more then 30 minutes) and be included inside the helpfile. github.com/jvanegmond Link to comment Share on other sites More sharing options...
dnsi Posted November 25, 2006 Author Share Posted November 25, 2006 It loops thou i dont think so... you should see if it crashes... My Programs:Flip-Flop File Encryption SysyemMULTIPLAYER-SOCKETSERVERHide An Archive In A Picture Link to comment Share on other sites More sharing options...
Snarg Posted November 25, 2006 Share Posted November 25, 2006 So this is some kind of chat server....? I think you are going to have issues if you ever get a lot of connections with a lot of data coming in and out. While the main portion of the script cycles through 9999 times, it is bound to miss a lot of data on the port. A little reading goes a long way. Post count means nothing. Link to comment Share on other sites More sharing options...
clearguy Posted November 26, 2006 Share Posted November 26, 2006 So this is some kind of chat server....? I think you are going to have issues if you ever get a lot of connections with a lot of data coming in and out. While the main portion of the script cycles through 9999 times, it is bound to miss a lot of data on the port.What kind of server it is ??? Look at the title of this topic .The cycles are there to polling the TCPAccept() to check out if any data has been recieved!For the miss of data, I don't really know, tests with uber-incoming connections should be done to know it.If you have any idea or script to make a better server please post it . Clearguy I've never met anyone who codes binary. StringMultiInsert()SOW EncryptFrench autoit forum - forum français Link to comment Share on other sites More sharing options...
Snarg Posted November 27, 2006 Share Posted November 27, 2006 What kind of server it is ??? Look at the title of this topicIt still does not make any sense. So, you allow multiple connections to your computer.... Then what?The cycles are there to polling the TCPAccept() to check out if any data has been recieved!I realize that. However, with 'uber-incoming connections' you will miss data. At the very least, the data is going to be jumbled up in the buffer and you will have no clue who has sent what.If you have any idea or script to make a better server please post it . ClearguyI will, just not right now. It is under development and horribly ugly right now. A little reading goes a long way. Post count means nothing. Link to comment Share on other sites More sharing options...
jvanegmond Posted November 27, 2006 Share Posted November 27, 2006 I will, just not right now. It is under development and horribly ugly right now.I'm sure that most people who visit these forums regularly can probably write a better server then that. Multi-connection servers are so incredibly easy to create. Blueprints for standard multi connection servers exist, the only problem is they are inside my head. AutoItSmith has shown a few great examples on how to build these servers. You should stop sharing these ugly scripts with anyone. github.com/jvanegmond Link to comment Share on other sites More sharing options...
Snarg Posted November 28, 2006 Share Posted November 28, 2006 I'm sure that most people who visit these forums regularly can probably write a better server then that. Multi-connection servers are so incredibly easy to create. Blueprints for standard multi connection servers exist, the only problem is they are inside my head. AutoItSmith has shown a few great examples on how to build these servers. You should stop sharing these ugly scripts with anyone.Is this directed at me or the original poster...? The script in this thread is *NOT* mine. A little reading goes a long way. Post count means nothing. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now