Incy IdDayTime Connection problem - indy

I created some software which is using some kind of selfmade license files under Delphi 5 Enterprise. The license expires after a certain time to prevent further use. As it is easy to adjust any desired date on a PC I am trying to get a connection to an internet timeserver.
I tried several codes I found in the internet, none worked. My last try was installing the Indy components and using some simple code like the following:
IdDayTime1.Host := .... desired timeserver
IdDayTime1.Connect;
Label1.Caption := IdDayTime1.DayTimeStr;
IdDayTime1.Disconnect;
I always do not get a connection to a timeserver. This happens in different network areas (at work, at home,...), even if all typical internet software (like firefox, IE,...) works very well in all these networks. So I am sure to have a proper internet connection.
What might be the reason for my problems ?
Do I have to define some special details like ports or sth. else ?
Thanks in advance for any help

Which version of Indy did you use? Which time server are you using? There are several different date/time protocols on the internet. TIdDayTime implements the Daytime Protocol (RFC 867), which is meant for retreiving human-readable date/time strings. For machine-parsable date/time data, especially if you intend to update the PC's clock with it, then use TIdSNTP (Simple Network Time Protocol, RFC 2030) or TIdTime (Time Protocol, RFC 868) instead.

Related

Are there any ways to monitor all HTTP protocols and block certain ones using a single script on WIndows?

I want to write a program that can monitor all system HTTP/HTTPS protocols used to open the default browser, and block certain ones, automatically changing certain requested URL into another. The process of changing a URL is simple, but the monitoring and blocking part is quite puzzling.
e.g. When clicking on the URL 'https://example.com/asdf.htm', the request will be blocked by the program and the the Windows system will receive the command of 'http://www.example2.org/asdf.htm' instead and the latter instead of the former URL will be opened by the default browser.
I am an amateur developer and student who do not have much experience in solving such problems.
I searched the web and found someone asked a similar question years ago:
https://superuser.com/questions/554668/block-specific-http-request-from-windows
However, I didn't find any useful advice on coding in the page. Maybe I can use an antivirus program to block certain URLs or change the hosts file to block certain URLs but the URL replacement cannot be done. Certainly, changing the hosts to a certain server which redirects certain requests might work but that's too complex. I wish someone can help me solve the problem by giving a simple method on monitoring the Windows system itself. Thanks!
To summarize our conversation in the comments, in order to redirect or restrict traffic, either to sites, either to ports (protocols are actually "mapped" via ports) the main solutions usually are:
a software firewall - keep in mind that SWFW don't usually redirect, they just permit or allow traffic via ports
a hardware firewall (or advanced router, not the commercial ones, but enterprise grade) - they do what you want, but they are very expensive and not worth for a home experiment
a proxy server - this can do what you want
Other alternatives that might or might not work would include editing the hosts file, as you said, but as stated earlier I don't recommend it, it's a system file and if you forget about it, then it can be a hindrance (also keep in mind that normally you should not use a Windows user with admin rights even at home, but that is another story) and a browser extension (which Iwould guess only changes content on pages, not the way a browser works (such as changing URLs).
I think a proxy server is the best pick here. Try it and let me know.
Keep in mind I still recommend you read about networking in order to get a better idea of what you can and can't do in each setup.

Add protocol to gammu

By default gammu have support for most standard modem. I have a very particular modem with some special requirements and I would like to add a protocol to gammu.
Is there a guide for this somewhere or someone who can list the basic steps for me?
EDIT: #user1664784 recommended to look att Kannel, and actually any system able to handle incoming and outgoing SMS is acceptable as long as it is stable. But I need to know how to modify the system so that I can handle a specific protocol. It is AT-based but a slight dialect. So any suggestion of a system handling SMS from a device connected over serial port is interesting. I need to find a system where someone can give me information on where in the source code I can begin adding a new AT-based protocol.
If someone have done some sample code in this area it would also be greatly appreciated.
It really depends how much different it is from standard AT commands.
If the difference is minor (eg. needs custom initialization), it can be easily achieved by feature flags. This can be seein ATGEN_PostConnect which handles initialization for ZTE or Huawei devices.
If the differences are big, you will probably need to write own driver, which will fall back to AT in some cases. Something similar can be seen in the AT OBEX driver which switches Bluetooth connection between OBEX and IrMC modes.
I think we used to have documentation on adding support for new devices, but I'm unable to find it right now.

Building embedded system with no reliable internet connection

I'm not really sure how to search this over the internet, I tried some searches but never got the help I needed, so I'll just ask here. (sry if it's already answered!)
I'm building a embedded system that runs on windows. I'll gather some data and send over the internet to read at home. I'm most probably using a 3G connection to connect my system (that will keep moving) to the internet and send the data over. I planned to use a ftp server with a hamachi connection to send the files to another pc. And it'll be automated, so the only person action will be to read the data at home. I tested and this all works fine when I use a reliable connection, like when I'm home.
My question is, will it work when my 3G connection drops and how can I make this system reliable?
I want to keep storing the data if the connection is down and send it all when it's back online, but i don't know if the system will automatically connect (i can't have a person manually clicking 'connect') to hamachi or to the ftp server (my first time using this technologies).
Also, is there a better, more reliable or simpler way than hamachi+ftp to send the data?
Thx,
EDIT: Adding more info. I'm gathering data with a LabView VI. The plan was to save this data into a file (txt, csv or whatever), send the file over and have another VI reading the file and display some graphs and etc. There is a DataSocket in Labview to send some data over the internet, but I'm not familiar with these internet protocols, it says I can use FTP, HTTP and others. What is paid and what can i do for free?
Also, is there a better, more reliable or simpler way than hamachi+ftp to send the data?
Might it be simpler to use e-mail (SMTP)? That has the advantage that the sender and receiver need not be up at the same time.

Which FTP transfer modes are widely used?

Reading the FTP RFC (RFC959), I notice some modes that I've never seen used, and indeed don't seem to be implemented by popular FTP software (vsftpd for example). In particular, for the STRU command, only file mode "STRU F" is commonly used, and for the MODE command, only stream mode "MODE S" is commonly used.
So the question is, when following best practice for developing interoperable FTP client and server software:
Is it useful to support the other STRU options (record and page)? These seem like something very old fashioned.
Is it useful to support the other MODE options (block and compressed)? I can see the point in compressed, but I'm particularly wondering whether any clients/servers will expect block to be there.
Are there any surveys of which existing FTP implementations support which options?
(On the MODE one, I can see why compressed is useful, I'm more wondering about whether any clients/servers will expect block mode to be there).
I maintain a custom FTP server and regularly refer to http://cr.yp.to/ftp.html for these sort of questions. Specificly, I followed the suggestions for TYPE/MODE/STRU at http://cr.yp.to/ftp/type.html and so far have had no issues.
No client I've seen connect has sent an STRU request besides "STRU F". Similarly, I've only ever seen "MODE S".
I would suggest to search for open source FTP clients and servers (especially those still being actively updated) and look at how many of them implement these "obsolete" transfer modes.
I made once (about seven years ago) a FTP client and implemented just the most basic transfer modes (ASCII and binary, if I remember correctly). Never had a problem with any server when using it.
It sounds like you are mostly concerned with interoperability. The answer is a bit different between client and server.
For server, you want to implement the basic modes that clients use. For every client, you need to support a minimum of one configuration, so the number of combinations should be relatively low. Beyond the minimum, supporting active -and- passive mode would probably the major addition (the mozilla community has wanted passive support for a long time, and it is probably never going to happen).
If you are a client, providing good URL support and date/time handling is probably the biggest barrier.

bandwidth and traffic simulator for web apps?

Can you suggest how to create a test environment to simulate various types of bandwidths and traffic in a web app?
Or maybe an open source program which does this against localhost?
I think this is a very important subject when programming web apps but it is not a usual topic, the only way i can imagine to create such kind of environment is to use some kind of proxy in a local network but before start looking into the squid documentation i would like to hear your suggestions.
if you're using apache you may want to take a look at apache ab
There are two approaches to shape network traffic to simulate a network link:
Run some software on the client or server that sits somewhere in the networking stack and shapes the traffic between the app and the network interface
Run the traffic shaping software on a dedicated machine with 2 network interfaces through which your traffic is routed
(2) is a better solution if you don't want to install software on the client or server (and possibly impact performance), but requires more hardware fiddling.
Some other features you might want to think about are what shaping parameters can be simulated. Most do delay and packet loss, some do jitter and bandwidth limiting as well. Some solutions can selectively filter traffic (for instance by port number, TCP or UDP etc).
Here is a list of some of the systems I've found:
Open Source or Freeware
DummyNet is an open source BSD Unix-based for dedicated devices. It is not clear if the software is being actively maintained
NistNet is an open source Linux-based system for dedicated devices. The software has not been actively maintained for several years.
Commercial
Apposite Technoligies sell dedicated hardware solutions for simulating WAN links, with a Web based GUI for configuring the settings and collecting traffic measurements
East Coast DataCom sell hardware dedicated simulators for simulating routers and modems
Itrinegy offer both dedicated device solutions, and solutions for running on clients or servers.
Network FX offer several dedicated device products for simulating network impairments between the client & server
NetLimiter is a client side system that allows throttling of individual applications, and includes a firewall.
Shunra Software offer a range of products, from high end enterprise WAN simulation and testing, to a simple client-resident emulator.
The closest I can think of is doing something similar with VEDekstop from Shunra..
Simulating High Latency and Low Bandwidth in Testing of Database Applications
Shunra VE Desktop Standard is a Windows-based client software solution that simulates a wide area network link so that you can test applications under a variety of current and potential network conditions – directly from your desktop.
I wrote a php script awhile back which used CURL to run a sequence of page requests against my server which represented a typical use scenario. I had it output the times that it took for the server to respond to each of the requests. I then had another script which spawned a bunch of these test case scripts simultaneously for a sustained period and correlated the results into a file which I could then look at in a spreadsheet to see average times. This way I could simulate the number of users hitting the site that I wanted. The limitations are that you need to run the test script on a different server to the web server and that the client machine can become too loaded to give meaningful results past a certain point. I've since left the job otherwise I would paste the scripts here.
If you are running a Linux box as your server, Linux box as your client, or have the capability to put (perhaps a VM) a Linux router between your client and server, you can use NetEm.
NetEm is a Linux TC (Traffic Control) discipline which can delay (i.e. add latency) packets leaving a host. Although it's tricky to set up clever rules (e.g. add latency to some traffic, not to others), it's easy to add a simple "delay everything leaving the interface by 50ms" type rules and some recipes are provided.
By sticking a Linux VM between your client and server, you can simulate as much latency as you like. And you can turn it on and off dynamically. Linux has other TC disciplines which can be combined with NetEm to restrict bandwidth (but the script to set this up can be somewhat complicated). NetEm can also randomly drop packets.
I use it and it works a treat :)
Web Application Stress Tool (WAST) from Microsoft is what you need.
http://www.microsoft.com/downloads/details.aspx?familyid=e2c0585a-062a-439e-a67d-75a89aa36495&displaylang=en
I haven't used it for years (lack of need, not because I'd found anything else), but xat webspeed would be the first thing I would point toward
As other people have mentioned, Apache's ab (comes with Apache, so you probably have it already) is good.
Other good options are:
HP's LoadRunner Apache
Jakarta's JMeter
Tsung (if you want to get your erlang on)
I personally like ab and JMeter the best.
We use Loadrunner to do bandwidth and traffic simulation in our App. Loadrunner is can start agents on various machines and you can simulate one machine as running on dialup modem v/s another on DSL v/s another on Cable internet.
We also use Loadrunner to simulate various kinds of traffic conditions from 10 user run to 500 user run. We can also insert think times in the script and simulate a real user executing the http request. The best part is that it comes with a recording studio where it will plug in with Internet explorer and you can record the whole scenario/Usecase that can be as simple as hitting one page to a full blown 50-60 page script or more.
i found this little java program that works great : sloppy
yet not a proffesional solution but it works for simple tests, i guess it uses java streams and buffers to slow down the connection .
Have you looked at Tsung? It's a great utility for seeing if your website will scale in event of attack, I mean massive popularity. We use it for our web frontend, and our internal systems too.
If you're interested in performing your tests out of your browser, there is also a really great Firefox plug-in.
Do not forget about Wanulator (http://www.wanulator.de/).
The name Wanulator comes from "WAN" and "simulator. This pretty much describes what the software does: It simulates different Internet conditions such as delay or packet loss. Furthermore it simulates user access line speeds e.g. modem, ISDN or ADSL.
Wanulator is currently packaged as a Linux boot CD based on SLAX. This will give you a full out of the box experience. You can turn any PC into a test-system within a blink - just by booting the Wanulator CD. The package already includes useful client SW such as web-browser and network sniffer (Wireshark). Nevertheless if the PC has 2 network interfaces the system can run as an intermediate system between your server and your client - as a switch - without any configuration hassles.

Resources