ok.. got a box that gathers data like temp, wind speed and stuff I collate the information and want to connect it to the INTERNET and send a udp packet containing that information. to a web site that stores data in a file and draws a nice graph of how the last years worth of data.
but just receiving the udp packet would help on a web site ?
What you're describing is a weather station and I would be researching which apps are compatible with it as there would be common data format standards between them. UDP is just a transport mechanism, it does not define what's in it or how to read it. Name of your weather station is the next step please..
the name of my weather station is called a Pic with Ethernet connection... I read the value of an adc do math to convert it from the ptc themistor value... but all of this is of no use if you dont understand the question about udp on a web server and I dont
think of it like this I want to send the correct amout of bytes for a udp packet can you help me grab them and put that information into a file on a web server ?
That's not enough, you have to know what the bytes represent. Some of them will not be your data. I'm not sure, but I think you don't actually control the packets yourself, but would use an existing tool. I think that would manage re-assembling the packets into the datastream/file that you would be interested in.
I may be totally wrong but at work they use Simba (I think) to transfer data from one system to another. The free package does all the hard stuff linking the different programs.
I'll need to check on Monday if I've remembered the name correctly. (It was designed to get a mac and Windows talking originally).
Treerat,
I think you are thinking of Samba which allows a Linux/UNIX type system to connect up to a share on a Windows server so that files can be saved over the network.
I think I understand what you are trying to do. Could you not write a small application (easy with VB) to receive the UDP packets, decode them and write the information to a database. Then have a web server with access to the database to display graphs and data as requested.
Sounds like an interesting project. Done a little PIC programming, but only in assembler. I presume the PIC's got a TCP/IP stack and an API of some flavour so you can send.
What O/S is the web server running on, and which is it. Windows, Linux, apache? and what languages are you coding in (on the server), PHP, C#? I'm sure we can dig out some code from somewhere, or I can maybe ask some of the more geekier geeks at the office.
As Adrian said, UPD is "fire and forget", there's no acknowledgement, so less traffic. I'm pretty sure you need to open up a port, the same port from either end. If you're handling both ends yourself, you can pick any port you want, but need to be careful it routes through firewalls etc.
the pic can be programmed in a C or a few other languages, Microchip offer a free stack. But me making hard work of it like to program assembler. I can send out a udp packet, which would contain a nated Ip address from my router and a destination address.
not interested in a any reply as I can check sum the data and rearange it at the server end if a packet gets lost or arrivers late.
now on the server side I am mess with javascript someone else is looking at ruby... but I dont care to be honest. put pacet into a file on server anyhow. Then another app can read file simples LOL
A lot will depend on what access you have to the webserver, and (as someone else said) what system the webserver is running. This isn't just something you upload to the webserver like your web pages - you need access at the shell level, and be able to start long running processes (or add something to inetd / xinetd if it's Linux, or start a Service if it's Windows). You could write the listener in one of a variety of languages - even C if that's what you know - but my language of preference is perl. To write something which just listens for a UDP packet, decodes it in some way, and then writes it to a database or to a file which can then be picked up by the webserver is probably no more than 30 or 40 lines of code. You'll find a million and one examples on the 'net of how to do this.
Assuming the UDP packet format is defined, and you're working on a Linux webserver where you have shell access, then if it were me doing it I'd say it's about 1-2 hours work, at £75/hour Of course, the ISP I run can also provide the webserver, etc, too
with a lot of digging about on the server I think I have access with perl and not js. which sort of explains some of the problems I have had. I have it working here in JS on my local machine and yes its just a few lines of code. Getting to run on the web server has been a different game, I am going to attempt in perl now. I would rather find a solution that is something that you can just upload and run. I am not saying it can be done but I will pm you slimey after I have failed LOL. sounds like you might be the person to help.
Also don't forget to talk to the firewall admin to allow the traffic on your port through, otherwise you could spend a considerable amount of time on troubleshooting your code . . .
yes thanks Paul I am slow making headway, as I said in my first post, not really my thing so its an interesting learning curve.
I can stick a hole in my router and put my pc on the net. then it all works but I dont want that I want it running on a hosted web server.
but 2 mins ago I worked out why my perl script was not running. so its going to be easy from now on LOL maybe not.
While you might want the graphs and information to be displayed on a website it's not actually a web server that you need for the data itself. Your weather station is just sending out a small data packet via UDP and, if it's connected up to t'Internet, then what you need is a server somewhere that can run an application to listen on the specified UDP port, receive the data and process it in some way (store in a database, write out to a file, etc).
Web servers don't typically listen for UDP traffic and don't act as generic IP servers - they are designed to handle specific TCP-based traffic: HTTP, etc.
You can certainly use Perl to write a UDP server - but it would need to be a standalone application really.
yes your 100% correct.
the question I asked was "udp socket to run on a web server anyone even understand"
what i need to do is just collect data in a file. but I want this done off site on a webserver
the whole point of question "if it's connected up to t'Internet" is it is connected to internet and it is/or will be sending out data via udp to an address I set.
but few few people seem to understand the low level commands the Internet is based on.
I dont but I am learning fast LOL can anyone else help or point me in the right direction.
PS its not a weather station its a bit of kit I am making to gather data and send it to the Internet
the solution was 6 lines of php... and data saved to my website in a file .... thanks for all the pointers
This is an older thread, you may not receive a response, and could be reviving an old thread. Please consider creating a new thread.
Related Threads
?
?
?
?
?
YD Scuba Diving Forums
2M posts
28.3K members
Since 2001
A forum community dedicated to Yorkshire Scuba divers and enthusiasts. Come join the discussion about scuba, equipment, medicine, styles, reviews, accessories, classifieds, and more!