Wednesday, April 22, 2026
HomeiOS Developmentios - SwiftUI Discovering Ethernet Printer challenge

ios – SwiftUI Discovering Ethernet Printer challenge

[ad_1]

please can somebody give me instructions on how you can uncover and join ethernet cabled thermal receipt printer.
I presently purchased Gprinter (there’s restricted SDK doc and its very outdated), data as under.
this printer has its personal wifi, as soon as I related to this printer’s distant wifi I’m able to print knowledge HOWEVER if related to this distant wifi, my app will not have web talents to add paperwork to firebase on account of no web.
code used to ship to this printer’s distant wifi.

it has a ethernet socket and I need it to develop into a community printer so my apps can entry it and print the tickets.
many thanks prematurely

   var deal with : String
    var port : Int
    var job : URLSessionStreamTask!
    var command = Printer()
    init(host:String,port:Int) {
        print("init")
        self.deal with = host
        self.port = port
        setupConnection()
    }
    
    func setupConnection() {
        print("setup")
        let session = URLSession(configuration: .default)
        job = session.streamTask(withHostName: deal with, port: port)
        self.job.resume()
    }
    
    func ship(knowledge:NSData){
        self.job.write(knowledge as Knowledge, timeout: 5.0) { error in
            if error == nil {
                print("Knowledge Despatched")
            } else {
                print("Noe")
            }
        }
    }
    
    func sendCommand(_ knowledge: Knowledge){
        ship(knowledge: knowledge as NSData)
    }

enter image description here
enter image description here

[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments