That's the long way home.
Netcat is your friend for little things like this.
A more meticulous approach that uses gawk 3.1.0's
network capability is something like this:
##
function openFile(fname, arra,i) {
i=1
while ((getline < fname) > 0) {
mylist = length(mylist) < 1 ? $0"\n" : mylist"\n"$0"\n"
i++;
}
printf "Read %d records\n", i
close(fname)
return mylist
}
function compFiles(arr1,arr2,len, x) {
for (x=0 ; x <= len ; x++) {
printf "Comparing %s and %s\n", arr1[x], arr2[x]
if (arr1[x] != arr2[x]) {
return 0
}
}
return 1
}
function copytoFile(farray,xx, i) {
i=0
printf "Filename(full path) to copy data to: "
getline name < "-"
while (i <= xx) {
print farray
>> name
i++
}
close(name)
return i
}
BEGIN {
port = 7700
if (ARGV[1] == "client" && ARGC == 3) {
printf "Address of server: "
getline add < "-"
plist = openFile(ARGV[2])
z = split(plist,clientfile,"\n"
cnt = 1
sock = "/inet/tcp/0/" add "/" port
printf "\r\n" |& sock
while ((sock |& getline) > 0) {
serverfile[cnt++] = $0
}
close(sock)
printf "Local file length = %d\n, remote file length = %d\n", z, cnt
if (z == cnt && (x = compFiles(clientfile,serverfile,z)) > 0) {
printf "Files are the same\n"
exit
} else {
printf "Files are not the same\n"
copytoFile(serverfile,cnt)
exit
}
} else if (ARGV[1] == "server" && ARGC == 3) {
flg = 1
plist = openFile(ARGV[2])
z = split(plist,serverfile,"\n"
service = "/inet/tcp/" port "/0/0"
#feed the socket data
do {
fcnt = 0
#wait for the connect
while ((service |& getline) > 0 && fcnt++ <= z) {
printf plist |& service
print "Sending", plist
close(service)
}
#close the connection
} while (flg == 1)
} else {
printf "Improper args to script %s, %d\n", ARGV[1], ARGC
exit
}
}
Poor mans awk mmap and file server in 80 lines 
Called like this for server:
gawk -f scriptname server "filename1"
gawk -f scriptname client "filename2"
You should be able to adapt the idea easily enough.
HTH