                     data,
                     len,
                     flags,
-                    addr.addrinfo.ai_addr,
-                    UInt32(addr.addrinfo.ai_addr.memory.sa_len)
+                    address.addrinfo.ai_addr,
+                    UInt32(address.addrinfo.ai_addr.memory.sa_len)
                 )
                 guard success != -1 else {
                     throw SocketError.SendToFailed(errno)

            }
            return isSuccess
    }
    public func send(str: String, flags: Int32 = 0, maxSize: Int = 1024) throws {
        let length = str.lengthOfBytesUsingEncoding(NSUTF8StringEncoding)
        try self.send(str, length: length, flags: flags, maxSize: maxSize)
    }
    /// Make sure that data is already base 64 encoded, this just uses 
    /// data.bytes and data.length (whene data is NSData).
    public func send(data: NSData, flags: Int32 = 0, maxSize: Int = 1024) throws {
        let len = data.length
        try self.send(data.bytes, length: len, flags: flags, maxSize: maxSize)
    }
}
extension Socket {

            }
            return bytesSent
    }
	/// Sends `data` to the specified peer.
	///
	/// If the socket is a connectionless socket, then it is acceptable
	/// to provide different values for the address parameter. On the 
	/// other hand, if the socket is connection orientated, the address
	/// connected to must be provided. This is typically `self.address`.
	/// The method `send(data:length:flags:maxSize)` has been provided 
	/// for conviently calling `sendto`.
	///
	/// - parameters:
	///		- address:		The address to send data to.
	///		- data:			A pointer to the buffer to send.
	///		- length:		The length of the buffer in bytes.
	///		- flags:		Controls additional options for sending
	///						data. Default is 0.
	///		- maxSize:		The maximum size of each packet (in bytes) when 
	///						sending large amounts of data. If a buffer is two
	///						big to send, then it will be split into multiple
	///						packets.
	/// - Returns:
	///						The number of bytes sent.
	/// - Throws:
	///		- `SocketError.SendToFailed`
    public func send(to address: AddrInfo, data: UnsafePointer<Void>,
        length: Int, flags: Int32 = 0, maxSize: Int = 1024) throws -> Int {
			var data = data 
            var bytesleft = length
