def process_request():
  msg = None
  # Read the data in the socket.
  try:
    msg = lind_test_server.recvfrom_syscall(listensockfd, 1024, 0)
    assert msg != None, "Socket failed to recv message."
  except Exception, e:
    print "UDP Connect Test : ", e
示例#2
0
def process_request():
    msg = None
    # Read the data in the socket.
    try:
        msg = lind_test_server.recvfrom_syscall(listensockfd, 1024, 0)
        assert msg != None, "Socket failed to recv message."
    except Exception, e:
        print "UDP Connect Test : ", e
def process_request():
    """
  <Purpose>
    Process the incoming data using above specifed tests
  """

    rip, rport, newsockfd = lind_test_server.accept_syscall(serversockfd)

    #Process first test...
    try:
        msg = lind_test_server.recvfrom_syscall(newsockfd, 100, MSG_PEEK)
        assert len(msg[2]) == 100, "Length expected 100 bytes to peek, but only" \
          + " got " + str(len(msg[2])) + " bytes."
        msg = lind_test_server.recvfrom_syscall(newsockfd, 100, 0)
        assert len(msg[2]) == 100, "Length expected 100 bytes to read, but only" \
          + " got " + str(len(msg[2])) + " bytes."
    except Exception, e:
        print 'TEST:- W:100, P:100, R:100 : ', e
def process_request():
  """
  <Purpose>
    Process the incoming data using above specifed tests
  """

  rip, rport, newsockfd = lind_test_server.accept_syscall(serversockfd)  
  
  #Process first test...
  try:
    msg = lind_test_server.recvfrom_syscall(newsockfd, 100, MSG_PEEK)
    assert len(msg[2]) == 100, "Length expected 100 bytes to peek, but only" \
      + " got " + str(len(msg[2])) + " bytes."
    msg = lind_test_server.recvfrom_syscall(newsockfd, 100, 0)
    assert len(msg[2]) == 100, "Length expected 100 bytes to read, but only" \
      + " got " + str(len(msg[2])) + " bytes."
  except Exception, e:
    print 'TEST:- W:100, P:100, R:100 : ', e
    #Process first test...
    try:
        msg = lind_test_server.recvfrom_syscall(newsockfd, 100, MSG_PEEK)
        assert len(msg[2]) == 100, "Length expected 100 bytes to peek, but only" \
          + " got " + str(len(msg[2])) + " bytes."
        msg = lind_test_server.recvfrom_syscall(newsockfd, 100, 0)
        assert len(msg[2]) == 100, "Length expected 100 bytes to read, but only" \
          + " got " + str(len(msg[2])) + " bytes."
    except Exception, e:
        print 'TEST:- W:100, P:100, R:100 : ', e

    emultimer.sleep(0.2)

    #Process second test...
    try:
        msg = lind_test_server.recvfrom_syscall(newsockfd, 20, 0)
        assert len(msg[2]) == 20, "Length expected 20 bytes to read, but only" \
          + " got " + str(len(msg[2])) + " bytes."
        msg = lind_test_server.recvfrom_syscall(newsockfd, 20, MSG_PEEK)
        assert len(msg[2]) == 20, "Length expected 20 bytes to peek, but only" \
          + " got " + str(len(msg[2])) + " bytes."
        msg = lind_test_server.recvfrom_syscall(newsockfd, 80, 0)
        assert len(msg[2]) == 80, "Length expected 80 bytes to read, but only" \
          + " got " + str(len(msg[2])) + " bytes."
    except Exception, e:
        print 'Test:- W:100, R:20, P:20, R:80 : ', e

    emultimer.sleep(0.2)

    #Process thrid test...
    try:
  #Process first test...
  try:
    msg = lind_test_server.recvfrom_syscall(newsockfd, 100, MSG_PEEK)
    assert len(msg[2]) == 100, "Length expected 100 bytes to peek, but only" \
      + " got " + str(len(msg[2])) + " bytes."
    msg = lind_test_server.recvfrom_syscall(newsockfd, 100, 0)
    assert len(msg[2]) == 100, "Length expected 100 bytes to read, but only" \
      + " got " + str(len(msg[2])) + " bytes."
  except Exception, e:
    print 'TEST:- W:100, P:100, R:100 : ', e

  emultimer.sleep(0.2)

  #Process second test...
  try:
    msg = lind_test_server.recvfrom_syscall(newsockfd, 20, 0)
    assert len(msg[2]) == 20, "Length expected 20 bytes to read, but only" \
      + " got " + str(len(msg[2])) + " bytes."
    msg = lind_test_server.recvfrom_syscall(newsockfd, 20, MSG_PEEK)
    assert len(msg[2]) == 20, "Length expected 20 bytes to peek, but only" \
      + " got " + str(len(msg[2])) + " bytes."
    msg = lind_test_server.recvfrom_syscall(newsockfd, 80, 0)
    assert len(msg[2]) == 80, "Length expected 80 bytes to read, but only" \
      + " got " + str(len(msg[2])) + " bytes."
  except Exception, e:
    print 'Test:- W:100, R:20, P:20, R:80 : ', e

  emultimer.sleep(0.2)

  #Process thrid test...
  try: