Serial.write() shows compiler warning, why?

I have this (abbreviated) Telnet/Wifi server code in my sketch:

    char buf[1024];  //Buffer for serial server
    unsigned int bytesAvail, bytesIn;
....
            //get data from the telnet client and push it to the UART
            while ((bytesAvail = tcpServerClients[i].available()) > 0)
            {
                bytesIn = tcpServerClients[i].readBytes(buf, min(sizeof(buf), bytesAvail));
                if (bytesIn > 0)
                {
                    Serial.write(buf, bytesIn);  //Getting warning here!
                    delay(0);
                }
            }
        }

On the Serial.write line there is a warning saying the following:

Invalid arguments
Candidates are:
unsigned long int write(unsigned char)
unsigned long int write(unsigned long int)
unsigned long int write(long int)
unsigned long int write(unsigned int)
unsigned long int write(int)
unsigned long int write(unsigned char)
unsigned long int write(const char *)

All of the suggested candidates use a single argument and this is of course not sufficient if one wants to send a binary buffer including zero bytes...

I have tried in vain to find the syntax declaration for the overloaded write() functions but to no avail...

Is there really no Serial.write() function that can take a source buffer of bytes and the number of bytes to send?

I have tried in vain to find the syntax declaration for the overloaded write() functions but to no avail...

Did you look at the source code? I suspect that the issue is that write() doesn't have an overload that takes an unsigned int as the second argument, since it doesn't really expect to send that much binary data in one call.

Is your telnet client really sending binary data? The print() method might be more appropriate.

It would be more helpful if you posted the full warning output.

It would be more helpful if you provided a complete minimal example code.

Which board do you have selected from the Tools > Board menu?

...And look up the difference between a warning and an error.

Try to cast your buffer with "Serial.write((const char*)buf, bytesIn)" and see what happens.

BosseB:

       Serial.write(buf, bytesIn);  //Getting warning here!

On the Serial.write line there is a warning saying the following:
All of the suggested candidates use a single argument and this is of course not sufficient if one wants to send a binary buffer including zero bytes...

Odd. The docs Serial.write() - Arduino Reference say that there is a write(buf, len).

Usually in the C world, there is a .write(buf, offs, len). offs is the offset into the buffer. Try

       Serial.write(buf, 0, bytesIn);  //Getting warning here!

The docs Serial.write() - Arduino Reference say that there is a write(buf, len).

As usual, the documentation is worthless, since it says nothing about the types of the arguments. Is adding that SO difficult?

Actually adding that is easier than it's ever been since you can now submit pull requests to the repository that contains all the Arduino language reference content:

I'm planning to do this comprehensively for the entire language reference but that's a big job so I haven't gotten around to it yet.

There is actually a long outstanding issue report in that repository for this:

That dates from when the repository was just a placeholder but it's now fully active and the Arduino team have been pretty responsive ever since the system went online. I have seen very few pull requests rejected, and those were not a big surprise.

PaulMurrayCbr:
Odd. The docs Serial.write() - Arduino Reference say that there is a write(buf, len).

Usually in the C world, there is a .write(buf, offs, len). offs is the offset into the buffer. Try

       Serial.write(buf, 0, bytesIn);  //Getting warning here!

Actually, while I am writing the code and have reached Serial.write then code completion pops in and shows a number of variations I can use including

write(const char * buffer, size_t size)
write(uint8_t buffer * buffer, size_t size)

But after I have completed it as shown above there is immediately a bug symbol in the left margin complaining about the code as I posted...

Regarding the docs, I found the page you refer to but it does not say which overloads are actually available and the variable types to use...
I don't even know if I have to use buf or &buf or buf[0] or &buf[0] or simply buf as the first argument...

BosseB:
But after I have completed it as shown above there is immediately a bug symbol in the left margin complaining about the code as I posted...

What IDE are you using?

If you actually want help you could go ahead and answer the questions I asked earlier.

pert:
It would be more helpful if you posted the full warning output.

It would be more helpful if you provided a complete minimal example code.

Which board do you have selected from the Tools > Board menu?

There is no warning output!
But in the left margin of the code window there is a bug symbol on the offending line and when I hover the mouse on top of it the warning/error I posted shows up. The sketch still verifies…
I thought that I had shown a minimal code example, what else should have been there?
The #includes perhaps:

#include "serialcomm.h"

and in that header is:

#include <ESP8266WiFi.h>
#include "espconfig.h"

and in espconfig.h is:

#include <ESP8266WiFi.h>
#include <EEPROM.h>

I have selected the “Generic ESP8266 module” board.
PS: I am using the Sloeber Eclipse Arduino IDE. DS

OK, well I have no experience with Sloeber so I don't know about this lack of a warning (actually error) thing. I would expect that when you try to compile the code you will get the standard compiler output shown somewhere. Have you actually tried to compile it yet?

Now that I know you are using the ESP8266 core for Arduino I can point you to the relevant source code:

I can tell you that this minimal demonstration code compiles fine for Generic ESP8266 Module using the Arduino IDE:

void setup() {
  Serial.begin(9600);
  char buf[] = "asdf";
  unsigned int bytesIn = 3;
  Serial.write(buf, bytesIn);
}

void loop() {
}

Does it work for you?

Thanks,
yes even my code with the bug in the IDE compiles (== verifies) fine and the bridge functionality also works, I can open a PuTTY session towards the ESP-07S on its IP:port address and then communicate between PuTTY and the terminal connected to Serial (I use Termite). Of course I have no possibility to type as fast as the real application will and no binary data will be possible. But the code works.
I just wondered if I had done something wrong that is due to my inexperience with the Arduino system itself.

I had to ditch the Arduino IDE because it was lacking so many productivity features I have been used to in other systems and I found two Eclipse based ones of which I chose Sloeber. Gives all kinds of references and stuff that the Arduino IDE is missing.
But maybe also falsely flagging code bugs?