in reply to Transmit file over socket
I think your server has a logic error. Consider your code:
You probably want something like this instead:
For the following input data:... print "Got: $in\n"; if ($in =~ /#:#$/) { ... } elsif ($in =~ /_$/) { ... } elsif ($in =~ /__END$/) { ... } else { ... # save file }
Your logic will never get to the save file bit correctly, it will (almost) always fall inside the $in =~ /_$/ block and not saving the xml header correctly.Got: X-Call~4.xml#:#380_<?xml version="1.0"?>
You probably want something like this instead:
if ($in =~ /__END$/) { # close previous file } else { ($filename, $filesize) = $in =~ /^([^#]+)#:#(\d+)_/; if ($filename) { # create new file } # proceed with saving the file }
In Section
Seekers of Perl Wisdom