Why is it printing the wrong value.

Here's the snipit of the Code that works

 IPAddress Remote = Udp.remoteIP();
 int PortNum = Udp.remotePort();
 Serial.print(Remote);
 Serial.print(":"); 
 Serial.println(PortNum);

The output

192.168.0.110:123

Here's the snipit of the Code that shows the wrong IP Address

IPAddress Remote = Udp.remoteIP();
 int PortNum = Udp.remotePort();
String dataString = Remote;
dataString += ":";
dataString += PortNum;
Serial.println(dataString);

Output

1845536960:123

Why isn't it printing the correct IP Address?

It is printing the correct IP address, just in a format you are not familiar with.

It prints a different value because your variable 'Remote' is an object of type 'IPAddress'.

If you look inside the library where it is defined, you will see one of the class functions for 'IPAddress' is to convert the object to a 'const char *' ( a c-string) which is what the Serial.print() functions wants. That function takes each part of the value, converts it to a decimal string and inserts the '.' in between.

When you create your dataString, it is of type 'String' so the same conversion needs to take place but the class IPAddress doesn't know how to convert to a 'String' so you are most likely just getting the address of the variable assigned to dataString.

How do I solve it?

Use the code that prints in the form you expect.

I need a string to write it to an SD Card. The serial.print is only used for debugging.

I need a string to write it to an SD Card.

No, you don't. Write to the SD card in exactly the same way.

If you are using a standard Arduino, you can't use Strings anyway. They will cause your program to crash.

This works flawlessly. I've been using it for all my other projects that run 24X7.

SPI.h
SD.h
.
.
.
.
.

File dataFile = SD.open("datalog.txt", FILE_WRITE);
      if (dataFile) // if the file is available, write to it:
      {
        dataFile.println(dataString);
        dataFile.close();
        if(DEBUG)
          Serial.println(dataString);
      }

Ok, use the same idea to get your IP address on your SD card. You already have shown that using print method will get you the right output. You've already shown that you can use the print methods with an SD card. What is the hold-up now?

Silly Me @Delta_G Thanks