This Java program sends video frames over UDP using datagrams. It first defines an array containing the size of each video frame. It then generates dummy payload data and repeatedly sends each frame's worth of data in packets. For each frame, it calculates the number of packets needed based on the frame size and payload size. It sends each packet, incrementing the sequence number. After each frame is sent, it sleeps for 40 milliseconds before sending the next frame. The program connects to a server, sends the packets, and closes the socket when finished.
1 of 5
Download to read offline
More Related Content
Package akiyo
1. //package akiyo;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author rudi
*/
import java.io.*;
import java.net.*;
class Akiyo {
public static void main(String args[]) throws Exception
{// while(true){
int [] dataVideo = {15876,1223,1116,937,1163,1168,1079,1234,1289,1388,1230,1383,
1727,2016,2387,3010,3525,3753,3945,3897,3644,3300,2789,2589,2652,2404,2478,2
833,
3189,3298,3508,3337,2856,2745,2892,3148,3043,3154,3181,3050,15781,2408,2372,
2181,
2340,2411,2561,2866,2546,2158,1462,1326,1633,1934,2134,2199,2120,1713,2410,2
534,
2645,2724,2574,2482,2386,2230,2700,2717,2962,3254,3490,3707,3582,3338,2349,2
362,
2773,3116,3355,3417,15683,2516,2399,2387,2661,3169,3289,3123,2941,2971,2842,
2882,
2892,2826,2890,3111,2956,2615,1948,2047,1940,2163,2015,2283,3064,3270,3119,2
794,