A project that "could" be beneficial to the Renegade community. [message #239328] |
Mon, 15 January 2007 23:22 |
|
Dave Anderson
Messages: 1953 Registered: December 2004 Location: United States
Karma: 0
|
General (1 Star) |
|
|
Topic title: Project: SocketArchive.dll
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
The Socket Archive is a dynamic link library that makes coding Tcp and Udp connections extremely easy for even the beginner programmer. The dll consists of 2 main classes which are the Tcp and Udp classes.
Usually it takes anywhere over 100 lines of code to program a working connection whether Tcp or Udp. What I have done is condensed this code for the developers to around 2-4 lines of code. The dll itself contains over 500 lines of code, but all the programmer has to do is reference it in their project, code 2 lines of code and everything else is handled for them. This dll is fast in performance and there is hardly any delay in connections. So far the furthest connection was tested from Pueblo, Colorado to the UK and back with less than 2-3 seconds in delay.
As of now, the project is composed of only the Tcp portion in which the only coded part is the TcpListener which listens for incoming connections and handles the TcpClients. The server can accept as many clients as your computer or server can handle and puts each of them on their own thread. This dll is thread safe, so there isn't anything to worry about having cross-thread errors or performance loss issues.
The dll is coded in C++/CLI using .NET 2.0 technology. I have utilized the code to optimize this for optimal performance. The code also maintains C++ ISO Standards.
As of now, the following is what has been done:
Tcp Class
This class is the parent class that houses all Tcp content inside the dll.
Listener Class
The Listener class houses all the methods and handling of the object that handles the incoming client connects and incoming client data. Any connections that are incoming from a remote client are accepted and placed on their own threads to prevent single-thread complications and delays when sending and receiving data. All data is transferred via a network stream object and is converted between bytes and other data as needed.
The listener class only has one constructor in which you do not need to pass any arguements. You simply create and initialize a new instance of this class and the listener handles everything for you. The listener operates by automatically selecting your active network adapters IP Address and listens on Tcp port 80 so there is no port forwarding required.
The custom function that starts the listener has been implemented as StartListener(). (Default: Start() and then Listen().
Other custom implementations will include:
ListenIncomingText();
ListenIncomingBytes();
ListenIncomingFile();
ListenIncomingFiles();
As well as:
ReplyOutgoingText();
ReplyOutgoingBytes();
ReplyOutgoingFile();
ListenIncomingFiles();
Client Class
The Tcp Client has not yet been implemented yet, but will include all functions required to send and receive data as well as connections.
Other advantages of this dll are that all information required to be displayed to the user or application operator is passed to a single console window which will handle all application messages. The choice of a console was to give further optimal performance over that of a graphical user interface design.
The Udp class has yet to be implemented or thought over, but will be very similar to that of the Tcp class.
Please leave any comments/suggestions/flaming/ect. in this thread.
Thank you.
David Anderson
Founder, Software Consultant
DCOM Productions
Microsoft Partner (MSP)
[Updated on: Sun, 21 January 2007 23:46] by Moderator Report message to a moderator
|
|
|
|
Re: A project that "could" be beneficial to the Renegade community. [message #239355 is a reply to message #239328] |
Tue, 16 January 2007 02:21 |
dead6re
Messages: 602 Registered: September 2003
Karma: 0
|
Colonel |
|
|
I feel .NET code bloats the class/application.
Does it really need to include .NET? I have a very simple class that I use for IRC connections that also allows me to hook specific messages into my own functions, for example
IRC.Hook("MODE", IRC_ModeHandler);
Let all your wishes be granted except one, so you will still have something to strieve for.
|
|
|
|
Re: A project that "could" be beneficial to the Renegade community. [message #239385 is a reply to message #239355] |
Tue, 16 January 2007 05:46 |
|
Dave Anderson
Messages: 1953 Registered: December 2004 Location: United States
Karma: 0
|
General (1 Star) |
|
|
dead6re wrote on Tue, 16 January 2007 02:21 | I feel .NET code bloats the class/application.
Does it really need to include .NET? I have a very simple class that I use for IRC connections that also allows me to hook specific messages into my own functions, for example
IRC.Hook("MODE", IRC_ModeHandler);
|
You just need to make sure the user has .NET on their computer (which they most likely have the latest version already). Other than that, you don't need .NET for anything, everything else is handled for you. Aside from that, this dll runs fast and efficiently with no performance loss. The feedback is provided via consoles so there is no extra memory requirements either such as a GUI would need.
As for .NET "bloating" an application, it can only if you code inefficiently.
David Anderson
Founder, Software Consultant
DCOM Productions
Microsoft Partner (MSP)
[Updated on: Tue, 16 January 2007 05:51] Report message to a moderator
|
|
|
Re: A project that "could" be beneficial to the Renegade community. [message #239466 is a reply to message #239385] |
Tue, 16 January 2007 15:23 |
=HT=T-Bird
Messages: 712 Registered: June 2005
Karma: 0
|
Colonel |
|
|
Dave Anderson wrote on Tue, 16 January 2007 06:46 |
dead6re wrote on Tue, 16 January 2007 02:21 | I feel .NET code bloats the class/application.
Does it really need to include .NET? I have a very simple class that I use for IRC connections that also allows me to hook specific messages into my own functions, for example
IRC.Hook("MODE", IRC_ModeHandler);
|
You just need to make sure the user has .NET on their computer (which they most likely have the latest version already). Other than that, you don't need .NET for anything, everything else is handled for you. Aside from that, this dll runs fast and efficiently with no performance loss. The feedback is provided via consoles so there is no extra memory requirements either such as a GUI would need.
As for .NET "bloating" an application, it can only if you code inefficiently.
|
Problem 1: not portable platform-wise (a well-written native sockets class should not have too many problems dealing with the differences between NT (WinSock2) and BSD sockets)
Problem 2: doesn't fit into everybody's apps (some people have severe issues with C++ native<->CLR interop)
Problem 3: CLR is a lot of overhead for some people (like when you are trying not to drag down people's SFPS)
HTT-Bird (IRC)
HTTBird (WOL)
Proud HazTeam Lieutenant.
BlackIntel Coder & Moderator.
If you have trouble running BIATCH on your FDS, have some questions about a BIATCH message or log entry, or think that BIATCH spit out a false positive, PLEASE contact the BlackIntel coding team and avoid wasting the time of others.
|
|
|
Re: A project that "could" be beneficial to the Renegade community. [message #239467 is a reply to message #239328] |
Tue, 16 January 2007 15:30 |
|
Dave Anderson
Messages: 1953 Registered: December 2004 Location: United States
Karma: 0
|
General (1 Star) |
|
|
Quote: | Problem 1: not portable platform-wise (a well-written native sockets class should not have too many problems dealing with the differences between NT (WinSock2) and BSD sockets)
Problem 2: doesn't fit into everybody's apps (some people have severe issues with C++ native<->CLR interop)
|
Quote: | Problem 3: CLR is a lot of overhead for some people
|
Then this wouldn't be the kind of thing that type of coder would use. But for the people who do know C++/CLI and don't have trouble, its ideal (And I know a few people on here who do use C++/CLI, this isn't just for one group of coders here.)
Quote: | (like when you are trying not to drag down people's SFPS)
|
You're narrowing this down to just server related stuff in that part. You have to keep in mind that this isn't something that is meant for one purpose only; like connecting to servers. You have a lot of flexibility with a dll like this and it can be used for many purposes, server related or not. I'm not saying that my dll has any performance gain over native sockets, but there is nothing in this dll that would cause a performance loss in a server from a logical standpoint.
David Anderson
Founder, Software Consultant
DCOM Productions
Microsoft Partner (MSP)
[Updated on: Tue, 16 January 2007 15:39] Report message to a moderator
|
|
|
|
|
|
|
Re: A project that "could" be beneficial to the Renegade community. [message #239486 is a reply to message #239328] |
Tue, 16 January 2007 16:57 |
|
Dave Anderson
Messages: 1953 Registered: December 2004 Location: United States
Karma: 0
|
General (1 Star) |
|
|
I don't believe COM is a form of C++, its the Component Object Model that defines how objects interact within a single application or between applications. Dan is talking about CLI, a form of C++ developed by Microsoft to maintain C++ ISO standards.
David Anderson
Founder, Software Consultant
DCOM Productions
Microsoft Partner (MSP)
|
|
|
|
|
|
|
|
Re: A project that "could" be beneficial to the Renegade community. [message #239947 is a reply to message #239850] |
Thu, 18 January 2007 16:23 |
|
Dave Anderson
Messages: 1953 Registered: December 2004 Location: United States
Karma: 0
|
General (1 Star) |
|
|
Silent Kane wrote on Thu, 18 January 2007 11:01 | You should've written that dll in C or something and use structures or something to pass parameters around. Pretty easy to make it work on different platforms that way.
But nice idea anyways.
|
Oh, and yeah, the class has multiple constructors so you can choose to not pass a parameter (its handled by two custom properties: IP and Port), or you can specify parameters as you see fit. Right now the one that doesn't pass parameters doesn't make connections correctly, but I will get it working soon.
David Anderson
Founder, Software Consultant
DCOM Productions
Microsoft Partner (MSP)
[Updated on: Thu, 18 January 2007 16:25] Report message to a moderator
|
|
|
|
|
|
|
Re: A project that "could" be beneficial to the Renegade community. [message #240643 is a reply to message #239328] |
Mon, 22 January 2007 13:57 |
|
Dave Anderson
Messages: 1953 Registered: December 2004 Location: United States
Karma: 0
|
General (1 Star) |
|
|
Update: I have finished coding much functionality in this dll. Changes are as follows:
*StartCommandLine();
The StartCommandLine() function asserts the Tcp Server into a command line interface mode where the server operator can use server commands such as !help, !clients, etc. This is used to manually operate the server.
*StartListener();
The StartListener() function puts the Tcp Server into a listening state where the server will continually listen for a pending connection. When the pending state returns true, the StartListener() function accepts the client and returns. This particular function is used to manually operate and handle incoming connections. To set the server in automatic mode, please see StartListenerEx();
*StartListenerEx();
NOT IMPLEMENTED. However, this function resembles the above function except for it repeatedly loops and catches all client connnections.
*Command Line Interface Commands
!Clients | Displays a list of the currently connected clients.
!CloseClient | Disconnects a remote client from the server.
!EndCLI | Exits the command line interface mode.
!Help | Displays a list of valid commands.
!Start | Sets the server in a manual listening state.
!StartEx | Sets the server in a automatic listening state.
.
.
.
. many more to come.
*Note that this dll is explicitly for consoles in this build. Future builds will contain GUI support, but possibly not up until version 2.0.0.0.
Other Features
The dll supports up to 100 clients asynchronysly and only uses ~18MB of RAM.
David Anderson
Founder, Software Consultant
DCOM Productions
Microsoft Partner (MSP)
[Updated on: Mon, 22 January 2007 13:57] Report message to a moderator
|
|
|