I'm not sure what you mean by 'making raw TCP connections'. Are you able to create pages and CGI scripts on the server? If so, you should be able to use LWP on the client side:
Write a CGI script for the server that takes the path and name of a .jpg file, and sends a response page containing the metadata you want
create a page on the server to invoke the CGI script
write a client perl program using LWP that expects the page in the format you defined in (1)