Server Help Forum Index Server Help
Community forums for Subgame, ASSS, and bots
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   StatisticsStatistics   RegisterRegister 
 ProfileProfile   Login to check your private messagesLogin to check your private messages   LoginLogin (SSL) 

Server Help | ASSS Wiki (0) | Shanky.com
Bringing zones together
Goto page 1, 2  Next
 
Post new topic   Reply to topic Printable version
 View previous topic  Arena - cnc (asss) Post :: Post displaying speed  View next topic  
Author Message
BDwinsAlt
Agurus's Posse


Age:33
Gender:Gender:Male
Joined: Jun 16 2003
Posts: 1145
Location: Alabama
Offline

PostPosted: Wed Jun 06, 2007 11:35 pm    Post subject: Bringing zones together Reply to topic Reply with quote

I got bored so I made a biller. (Yeah...)
In a little over a day I have added this:
Code: Show/Hide

-------------------------------------------------------------------------------
NetOp Commands: ?broadcast
Owner Commands: None
Sysop Commands: None
Smod  Commands: ?addop, ?removeop
Mod   Commands: ?banip, ?bkick, ?getip
-------------------------------------------------------------------------------
Misc  Commands: ?binfo, ?bnews, ?btime, ?buptime, ?bversion, ?coin, ?man, ?sex
MSG   Commands: ?message, ?messages, msgdel
Other Commands: ?password, ?listop, ?listall
Squad Commands: ?squadjoin, ?squadpassword, ?squadowner, ?squadlist, ?squadkick
-------------------------------------------------------------------------------
Note: Syntax differs for some commands.  Type ?man <command> for help.


When I broadcast it sends "BROADCAST:PID:SOUND:TEXT" but only to that one zone.
How do I make it so it sends to everything connected to that port without it having to be a DGRAM socket where I would have to specify an ip and port for each zone.

Because my socket isn't DGRAM, socket.send doesn't seem to exist. How do I send strings of information to all clients connected. Will I have to turn it into bytes and so on?

This is Java because python wasn't splitting the strings of information correctly.
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website AIM Address Yahoo Messenger MSN Messenger
CypherJF
I gargle nitroglycerin


Gender:Gender:Male
Joined: Aug 14 2003
Posts: 2582
Location: USA
Offline

PostPosted: Thu Jun 07, 2007 1:20 am    Post subject: Reply to topic Reply with quote

You'll have to be careful with Java string splitting as well.

BLAH:BLAH:

Will result in 2 array items, not 3.
_________________
Performance is often the art of cheating carefully. - James Gosling
Back to top
View users profile Send private message Add User to Ignore List
BDwinsAlt
Agurus's Posse


Age:33
Gender:Gender:Male
Joined: Jun 16 2003
Posts: 1145
Location: Alabama
Offline

PostPosted: Thu Jun 07, 2007 1:37 am    Post subject: Reply to topic Reply with quote

I haven't messed with chats yet. I wonder how I will do that.
Yea so if I make it say info[3] (arguments) then the second BLAH will be info[4]. Thats gay.
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website AIM Address Yahoo Messenger MSN Messenger
Maverick
broken record


Age:39
Gender:Gender:Male
Joined: Feb 26 2005
Posts: 1521
Location: The Netherlands
Offline

PostPosted: Thu Jun 07, 2007 1:52 am    Post subject: Reply to topic Reply with quote

wow icon_eek.gif
You made it all out of scratch or did you use existing code?
_________________
Nickname: Maverick (I changed my name!)
TWCore developer | Subspace statistics
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
BDwinsAlt
Agurus's Posse


Age:33
Gender:Gender:Male
Joined: Jun 16 2003
Posts: 1145
Location: Alabama
Offline

PostPosted: Thu Jun 07, 2007 2:22 am    Post subject: Reply to topic Reply with quote

Well I added Commands to Skybill. All the bnews, buptime. btime... all that was from what I coded earlier. The squad/messaging is all I really had to focus on. I didn't take anything from any biller that I didn't already code. So yes it is scratch.
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website AIM Address Yahoo Messenger MSN Messenger
CypherJF
I gargle nitroglycerin


Gender:Gender:Male
Joined: Aug 14 2003
Posts: 2582
Location: USA
Offline

PostPosted: Thu Jun 07, 2007 2:46 am    Post subject: Reply to topic Reply with quote

Ah but can yours do what mine does (besides adding ops, lol)? icon_wink.gif

BTW, it's now running on hyperion.mineplowers.com incase the zone was red (you can update your dir listing).
Back to top
View users profile Send private message Add User to Ignore List
BDwinsAlt
Agurus's Posse


Age:33
Gender:Gender:Male
Joined: Jun 16 2003
Posts: 1145
Location: Alabama
Offline

PostPosted: Thu Jun 07, 2007 2:54 am    Post subject: Reply to topic Reply with quote

I'm working on it icon_biggrin.gif

I probably will never release/use it once I'm done. Just a project. if it looks really nice then I might. We'll see. icon_biggrin.gif

Edit: I made it so chats = squadchat for now.
I'm just testing my chat stuff. Right now if you type ';hey' it will send to everyone online in your squad. I'll have to figure out how I'm going to make multiple chats. That is also only zone-wide right now. I think I have an idea about how I can use a DGRAM socket to send chats and broadcasts net-wide.

EDIT II: Would anyone like to help me send messages?
Each zone is connected to the biller on it's own thread to keep them from clashing. icon_confused.gif
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website AIM Address Yahoo Messenger MSN Messenger
Cyan~Fire
I'll count you!
I'll count you!


Age:36
Gender:Gender:Male
Joined: Jul 14 2003
Posts: 4608
Location: A Dream
Offline

PostPosted: Thu Jun 07, 2007 9:39 pm    Post subject: Reply to topic Reply with quote

Messages: Just have each thread poll some function for messages waiting to be received.
_________________
This help is informational only. No representation is made or warranty given as to its content. User assumes all risk of use. Cyan~Fire assumes no responsibility for any loss or delay resulting from such use.
Wise men STILL seek Him.
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
BDwinsAlt
Agurus's Posse


Age:33
Gender:Gender:Male
Joined: Jun 16 2003
Posts: 1145
Location: Alabama
Offline

PostPosted: Thu Jun 07, 2007 9:59 pm    Post subject: Reply to topic Reply with quote

UBill.java
Code: Show/Hide

import java.net.*;
import java.io.*;

public class UBill {
    public static void main(String[] args) throws IOException {
        ServerSocket serverSocket = null;
        boolean listening = true;

        try {
            serverSocket = new ServerSocket(2555);
       System.out.println("Starting UBill 0.1...");
        } catch (IOException e) {
            System.err.println("Could not listen on port: 2555.");
            System.exit(-1);
        }

        while (listening)
       new UBillConnect(serverSocket.accept()).start();

        serverSocket.close();
    }
}


Part of UBillConnect.java
Code: Show/Hide

       PrintWriter out = new PrintWriter(socket.getOutputStream(), true);
       BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()));


Each zone has it's own out and in. If one zone sends: CHAT:X:X to the biller then the biller sends the CHATTXT, but only out with out.println(....);

I need CHATTXT to be sent to every 'out' that exists in any new UBillConnect.
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website AIM Address Yahoo Messenger MSN Messenger
Doc Flabby
Server Help Squatter


Joined: Feb 26 2006
Posts: 636
Offline

PostPosted: Thu Jun 07, 2007 10:05 pm    Post subject: Reply to topic Reply with quote

I would have a look at how i did it in skybill. (v0.3) I got the chats working perfectly http://forums.minegoboom.com/download.php?id=1888

And with theoretically no limit to the number of chats.
_________________
Rediscover online gaming. Get Subspace | STF The future...prehaps
Back to top
View users profile Send private message Add User to Ignore List
BDwinsAlt
Agurus's Posse


Age:33
Gender:Gender:Male
Joined: Jun 16 2003
Posts: 1145
Location: Alabama
Offline

PostPosted: Fri Jun 08, 2007 2:37 am    Post subject: Reply to topic Reply with quote

I used your biller to see how CHAT and CHATTXT worked. (Thanks for commenting your code biggrin.gif ).

I'll see what I can do. icon_biggrin.gif
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website AIM Address Yahoo Messenger MSN Messenger
BDwinsAlt
Agurus's Posse


Age:33
Gender:Gender:Male
Joined: Jun 16 2003
Posts: 1145
Location: Alabama
Offline

PostPosted: Fri Jun 08, 2007 2:44 am    Post subject: Reply to topic Reply with quote

Wow, now I get it working in python.
Python seems to send things faster. I'll stick with java since I can probably do more with that and I already coded a thousand lines.
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website AIM Address Yahoo Messenger MSN Messenger
Smong
Server Help Squatter


Joined: 1043048991
Posts: 0x91E
Offline

PostPosted: Fri Jun 08, 2007 8:24 am    Post subject: Reply to topic Reply with quote

BDwinsAlt wrote:
Code: Show/Hide

while (listening)
    new UBillConnect(serverSocket.accept()).start();
I think you need to keep track of all the UBillConnect objects inside a collection. Then when you want to broadcast you iterate over the objects and call a send method, something like:
Code: Show/Hide

while (listening)
{
    UBillConnect u = new UBillConnect(serverSocket.accept());
    collection.add(u);
    u.start();
}
...
broadcast(msg)
{
for each u in collection:
  u.send(msg)
}

It's going to be more complex than that since you need to remove disconnected zones from the collection.
_________________
ss news
Back to top
View users profile Send private message Add User to Ignore List Visit posters website MSN Messenger
BDwinsAlt
Agurus's Posse


Age:33
Gender:Gender:Male
Joined: Jun 16 2003
Posts: 1145
Location: Alabama
Offline

PostPosted: Fri Jun 08, 2007 3:52 pm    Post subject: Reply to topic Reply with quote

I'm still having trouble. I can't seem to figure out how to make the classes reach each other. Basically it looks like I'll have to store the collection in UBill, do the command in UBillConnect, go back to UBill to find the collection, and then figure out how to make sure it sends to all of them.

I've never done anything like this before. I've been googling forever.

EDIT:
I have everything done with the chats except for sending them to other zones.
I think that's really all I have left to do unless I feel like making an aliasing system. I try to make it all non-mysql so there are no drivers involved and not everyone can use mysql.
I know it's slower and not as efficent and more work, but it takes hard work to make a good looking biller anyway.

If you have any dumbed down code to help me get these threads to work with each other let me know.

UBill -> UBillConnect (broadcast cmd is found and work is done) -> UBill (Sends to all zones connected) <-- that is what I need somehow.

I can always port it to python if I get bored in the future.
Also, which is better, md5 or SHA? The only way to decode md5 is to md5 a string and see if it equals the md5 string right? I would think that was secure enough.
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website AIM Address Yahoo Messenger MSN Messenger
BDwinsAlt
Agurus's Posse


Age:33
Gender:Gender:Male
Joined: Jun 16 2003
Posts: 1145
Location: Alabama
Offline

PostPosted: Sat Jun 09, 2007 9:37 pm    Post subject: Reply to topic Reply with quote

I figured out how to communicate between classes. The only problem is it uses
Code: Show/Hide

public UBill u = new UBill();


So when I use u.msg (a string containing the broadcast) it isn't the same. How can I keep using one UBill?
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website AIM Address Yahoo Messenger MSN Messenger
Smong
Server Help Squatter


Joined: 1043048991
Posts: 0x91E
Offline

PostPosted: Sun Jun 10, 2007 7:33 am    Post subject: Reply to topic Reply with quote

You can make a static factory class. Like u = UBillFactory.getUBill(); The first time the function is called it will create one instance of UBill, all other times it returns that same instance.
Code: Show/Hide
public class UBillFactory
{
   private static UBill u;
   public static getUBill()
   {
      if (u == null)
         u = new UBill();
      return u;
   }
}
Back to top
View users profile Send private message Add User to Ignore List Visit posters website MSN Messenger
BDwinsAlt
Agurus's Posse


Age:33
Gender:Gender:Male
Joined: Jun 16 2003
Posts: 1145
Location: Alabama
Offline

PostPosted: Sun Jun 10, 2007 3:46 pm    Post subject: Reply to topic Reply with quote

I LOVE YOU! Thank you so much. You will be added in the huge thanks part of the credits.
icon_biggrin.gif

Thanks again. icon_razz.gif icon_lol.gif icon_smile.gif icon_biggrin.gif icon_cool.gif icon_surprised.gif biggrin.gif
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website AIM Address Yahoo Messenger MSN Messenger
Cyan~Fire
I'll count you!
I'll count you!


Age:36
Gender:Gender:Male
Joined: Jul 14 2003
Posts: 4608
Location: A Dream
Offline

PostPosted: Tue Jun 12, 2007 9:29 pm    Post subject: Reply to topic Reply with quote

That's not a Factory, Smong, it's a Singleton! Get your design patterns right. icon_razz.gif
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Smong
Server Help Squatter


Joined: 1043048991
Posts: 0x91E
Offline

PostPosted: Wed Jun 13, 2007 10:03 am    Post subject: Reply to topic Reply with quote

Heh I don't care only when I handed in some work the other day the guy said why didn't you use a "factory pattern" it works like this ...
Back to top
View users profile Send private message Add User to Ignore List Visit posters website MSN Messenger
Cerium
Server Help Squatter


Age:41
Gender:Gender:Male
Joined: Mar 05 2005
Posts: 807
Location: I will stab you.
Offline

PostPosted: Wed Jun 13, 2007 5:48 pm    Post subject: Reply to topic Reply with quote

factories create lots of objects
singletons create a single object
_________________
There are 7 user(s) ignoring me right now.
Back to top
View users profile Send private message Add User to Ignore List AIM Address
BDwinsAlt
Agurus's Posse


Age:33
Gender:Gender:Male
Joined: Jun 16 2003
Posts: 1145
Location: Alabama
Offline

PostPosted: Fri Jun 15, 2007 4:47 am    Post subject: Reply to topic Reply with quote

Whatever it's called it worked for me. Smong was added to bversion, display message on entry, and readme. I will be releasing it for beta testing after I beta test it myself and change a few things. Any suggested commands/functions?
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website AIM Address Yahoo Messenger MSN Messenger
Smong
Server Help Squatter


Joined: 1043048991
Posts: 0x91E
Offline

PostPosted: Fri Jun 15, 2007 5:21 am    Post subject: Reply to topic Reply with quote

How about making it save banners. Make sure there are ?changepassword and ?adduser op commands (and an option to not allow new users, so only ?adduser can be used).
Back to top
View users profile Send private message Add User to Ignore List Visit posters website MSN Messenger
BDwinsAlt
Agurus's Posse


Age:33
Gender:Gender:Male
Joined: Jun 16 2003
Posts: 1145
Location: Alabama
Offline

PostPosted: Fri Jun 15, 2007 12:18 pm    Post subject: Reply to topic Reply with quote

I haven't touched banners yet. I'll do that today when I get home. I added ?resetpassword for netops and I'll add ?adduser.
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website AIM Address Yahoo Messenger MSN Messenger
CypherJF
I gargle nitroglycerin


Gender:Gender:Male
Joined: Aug 14 2003
Posts: 2582
Location: USA
Offline

PostPosted: Fri Jun 15, 2007 5:18 pm    Post subject: Reply to topic Reply with quote

haha but how am i suppose to have fun, if i don't pound you and your biller to death. icon_wink.gif
Back to top
View users profile Send private message Add User to Ignore List
BDwinsAlt
Agurus's Posse


Age:33
Gender:Gender:Male
Joined: Jun 16 2003
Posts: 1145
Location: Alabama
Offline

PostPosted: Fri Jun 15, 2007 5:30 pm    Post subject: Reply to topic Reply with quote

Then it will be fun when I reverse enginner your biller and combine it with mine to crush yours hard core. icon_biggrin.gif
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website AIM Address Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Server Help Forum Index -> ASSS Custom Projects All times are GMT - 5 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
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 vote in polls in this forum
You can attach files in this forum
You can download files in this forum
View online users | View Statistics | View Ignored List


Software by php BB © php BB Group
Server Load: 656 page(s) served in previous 5 minutes.

phpBB Created this page in 0.470056 seconds : 50 queries executed (89.3%): GZIP compression disabled