def pageRequest(url,source_ip,destination_ip,client_seq,client_ack,server_seq,server_ack):
	host,path=netUtils.serverNameExtract(sys.argv[1])
	data_req=layer5.reqGenGet(host,path)
	print(data_req)
	tcp_header = layer4.packTCPHeader(source_ip,destination_ip, source_port, client_seq, client_ack,'PSHACK',data_req)
	ip_header = layer3.packHeader(source_ip,destination_ip)
	
	pck = ip_header + tcp_header + data_req
	soc = socks.createSendSock()
	recsock=socks.createRecvSock()	
	soc.sendto(pck,(destination_ip,80))
	raw=socks.recv(recsock)
	ihl,tcph,src_ip,dest_ip,iph,data,payLength = netUtils.xtractPacket(raw)
	soc.close()
	recsock.close
	#socks.debugPrintSeqNo(client_seq,client_ack,server_seq,server_ack)
	[server_seq2,server_ack2]=layer4.getServerSeqNo(tcph)
	k=len(data_req)+client_seq
	#print("k="+str(k)) 
	#socks.debugPrintSeqNo(client_seq,client_ack,server_seq2,server_ack2)
	if tcph[5]==0x010 and tcph[1]==source_port and server_ack2==k and server_seq2==server_seq:
		print("ACK packet recieved for get. handshake done")	
		#body=downloadPage(tcph,iph,source_ip,destination_ip,client_seq,client_ack)
		data=socks.recData(destination_ip,source_ip,source_port,client_seq,client_ack,server_seq2,server_ack2)
		header_data,body=layer5.xtractHeaders(data)
	#print(header_data)
	else:
		sys.exit("NO ack recieved for GET.pLease try later")
	return body
def sendFinAck(source_ip,destination_ip, source_port,seqNo,ackNo):
	soc = socks.createSendSock()
	ip_header = layer3.packHeader(source_ip,destination_ip)
	
	tcp_header = layer4.packTCPHeader(source_ip,destination_ip, source_port, seqNo, ackNo,'FINACK','')
	pck = ip_header + tcp_header
	soc.sendto(pck,(destination_ip,80))
	#print "Ack packet sent"
	#msg=socks.recv(soc)
	soc.close()
def sendSyn(source_ip,destination_ip, source_port):
	
	soc = socks.createSendSock()
	ip_header = layer3.packHeader(source_ip,destination_ip)
	seq = randint(0,42949)
	
	ack =0 
	tcp_header = layer4.packTCPHeader(source_ip,destination_ip, source_port, seq, ack,'SYN','')
	pck = ip_header + tcp_header
	soc.sendto(pck,(destination_ip,80))
	#print "SYN packet sent with seq:"+str(seq)
	#msg=socks.recv(soc)
	soc.close()
	
	return [seq,ack]