Question: Im using the framework SQLite from stephencelis

I have the problem that the commands can be only used within viewDidLoad().
But i have to use the defined variables (e.g. var carlist) in functions outside viewDidLoad.

Where is my logical problem?

My code snipped:

```
    override func viewDidLoad() {
     super.viewDidLoad()
     let db = Database("/Users/**/Desktop/NEW/car/car.sqlite")      
     let cars = db["cars"]
     let car_id = Expression<Int64>("car_id")
     let car_model = Expression<String?>("car_model")

     for car_list in cars {
        println("car_model: \(car_list[car_model])")
        var carlist[car_list[car_model]] // array
     }
    }

```

The error, if i move the lines after "let db" to outside: 'ViewController.Type' does not have a member named "db"

Answer: 
The packet consists of:

* the IP header (20 bytes)
* the UDP header (8 bytes)
* your payload (320 bytes).

Total: 348 bytes.
For calculating the number of packets you don't need to take into account the size of the transport or network layer headers. You specified a payload size of 320 bytes, which is well within the maximum size of a UDP payload without fragmentation.

Each time you call send() or sendto(), this will create a datagram (packet), so the math is simply dividing the total size by your 320 byte chunks:

1305477120 / 320 = 4079616 packets

As a side point, if you were to make your UDP payload larger, that would reduce the total number of packets. On a lot of networks, the MTU is 1500 bytes, so you can send:

*1500 bytes - IP header (20 bytes) - UDP header (8) bytes = 1472 bytes for payload*

As a second side point, if your UDP payload is too big, i.e. payload + IP/UDP headers exceeds the MTU, then your single call to send() would result in multiple IP fragment packets.