YD Scuba Diving Forums banner

udp socket to run on a web server anyone even understand this :-)

7K views 31 replies 11 participants last post by  David 
#1 ·
This is Right on the edge of my skill set go slow please

Thanks :)
 
#5 ·
yes but TCIP is just one layer up most VOIP is UDP
tcip is two way I dont need that or want that amount of traffic
 
#4 ·
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 ?
 
#7 ·
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..
 
#8 · (Edited)
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 ?
 
#9 ·
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.
 
#10 ·
I know how to send udp packets I understand what they do I dont know how to receive them :)
 
#11 ·
I can send a udp from pc to pc on my network. Meybe even to my website but I cant do or see anything that end.

How do I write a socket to receive udp packets is the question :)
 
#15 ·
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).
 
#19 ·
Hi David,

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.

Cheers,

Mark
 
#20 ·
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
 
#22 ·
er that is supposed to be me LOL if only you knew how few people can answer this question are you one of them and if so pm me about how much :)

please pm me so we can swap numbers and chat about how long and how much.
 
#23 ·
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 :)
 
#24 · (Edited)
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.

thanks
David
 
#27 ·
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.
 
#28 ·
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.
 
#29 ·
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 :)

thanks David
 
#32 ·
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.
Top