Gst_parse_launch not replicating gst-launch-1.0

I use gst-launch-1.0 to stream video to 127.0.0.1. All ok. But bundling that in C using gst_parse_launch it does not work. If I use a real ip eg 192.168.0.20 then all does work.
How would one stream to localhost using C (both udpsink and tcpserversink)

I ran debug and exactly duplicated the gst-launch caps.

Can you show your code and also how you were running gst-launch-1.0? Both should behave the same with regards to constructing the pipeline.

#!/bin/sh
gst-launch-1.0 -v v4l2src device=/dev/video6 !
video/x-h264,width=1920,height=1080,framerate=30/1 !
h264parse !
tee name=t !
queue !
avdec_h264 !
xvimagesink name=sink sync=false
t. ! queue ! rtph264pay ! udpsink port=5000 host=127.0.0.1

pipeline = gst_parse_launch ("v4l2src name=source ! "
"video/x-h264,width=1920,height=1080,framerate=30/1 ! "
"h264parse ! "
"tee name=t ! "
"queue ! "
"avdec_h264 ! "
"xvimagesink name=sink sync=false "
“t. ! queue ! rtph264pay ! udpsink name=ipsink”
, NULL);

GstElement *source  = gst_bin_get_by_name (GST_BIN (pipeline), "source");
GstElement *sink    = gst_bin_get_by_name (GST_BIN (pipeline), "sink");
GstElement *ipsink = gst_bin_get_by_name (GST_BIN (pipeline), "ipsink");
g_object_set (source, "device", argv[1], NULL);
g_object_set (ipsink, "port", atoi (argv[2]), NULL);
g_object_set (ipsink, "host", argv[4], NULL);

Works if host is not 127.0.0.1 which is why I’m baffled