Results 1 to 7 of 7
Thread: queue length of Socket
- 07-12-2008, 03:08 PM #1
Member
- Join Date
- Jul 2008
- Posts
- 3
- Rep Power
- 0
- 07-12-2008, 07:23 PM #2
Queue lenght is somewhat system dependent. It is supposed to be 65k or so but is often truncaked to around 40k by network traffic routers. Time of arrival would be implemented by a call to get system time early in DatagramSocket (Java 2 Platform SE 5.0))
this gets threading issues on the board, the thread that runs in rcv is new'ed by the system == if two datagram arrive at the same time calling sys time can result in packet n getting pancaked with packet n+1Introduction to Programming Using Java.
Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor
- 07-12-2008, 09:03 PM #3
Member
- Join Date
- Jul 2008
- Posts
- 3
- Rep Power
- 0
thanks for reply. but i didn't get this that when i get a packet i proceed to process the packet and then use its byte array to display an image. so only after a certain time i'll return to rcv meanwhile packets would have kept on queuing . so i cannot know their exact time?
can you suggest any way that i should interuupt my current thread whenever a packet comes to save it in a byte arr.
but this'll waste a lot of time.
- 07-12-2008, 11:57 PM #4
You could start another thread that polled for new input and read it into a queue for later processing.
Are there methods in the DatagramSocket class that will block until there is input to read? Put that in a loop and read whenever something comes in and queue it for processing by another thread.
Still don't know how to get EXACT time of arrival. Best would be when you first saw it.
- 07-13-2008, 04:57 AM #5
As @norm says, you can know pretty well when you processed it, and have a lightweight process that gets the data out of the socket and into an internal queue quickly. But you can *not* know when it arrived with any precision.
Its hard for me to think of a real reason why you would care. For auditing, or logging, you can just get the time you put it in the queue and call that good enough.
- 07-13-2008, 04:58 PM #6
Pancake, a new type of Stack
The way to approach this is a short, and I mean really short, code block snuggled up on accept, that .... ....? Why is this so important -> you are trying to correctly identifiy traffic so that requests can be grouped together? Session tracking, logging? There is some goal you are trying to attain that can be put into words. If not, you are trying to do systems work and that can end up with a cross-lock.
Send and receive run almost asynchronously, and are programmed at a level below Java. I am writing right now what I think you are trying to do. You likely want a SessionMaster object that can keep things organized. What happens if someone clicks the button twice accidenatlly?... happens all the time.can you suggest any way that i should interuupt my current thread whenever a packet comes to save it in a byte array?... but this'll waste a lot of ( processor power ).Introduction to Programming Using Java.
Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor
- 07-13-2008, 06:28 PM #7
Why would it waste time? You have to read from the socket and put the data in an array no matter when you do it.
You use multiple threads, Java has had them since 1.0. Its designed to have you do it this way.
You use a java.util.concurrent.CyclicBarrier or a similar object to coordinate.
Similar Threads
-
JBatchUpload - Queue files before upload
By jfileupload in forum Java SoftwareReplies: 0Last Post: 07-06-2008, 02:00 PM -
Queue data structure
By Java Tip in forum java.langReplies: 0Last Post: 04-14-2008, 08:35 PM -
Declaring a Queue
By rhm54 in forum New To JavaReplies: 1Last Post: 03-21-2008, 05:02 AM -
Help with queue array please!!
By vmcg105 in forum New To JavaReplies: 1Last Post: 03-08-2008, 07:03 PM -
Using a queue
By Krmeus in forum New To JavaReplies: 0Last Post: 12-10-2007, 03:38 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks